【问题标题】:The image size does not match the pixel图像大小与像素不匹配
【发布时间】:2014-03-21 16:19:38
【问题描述】:

有大小为200x100 的图像。但是,当我想使用

获取最后一个像素的 RGB 值时
int c = image.getRGB(200, 100);

出现错误。

java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!

我想问是不是像素宽度的问题。如果是,我该如何解决?

【问题讨论】:

    标签: java image-processing colors


    【解决方案1】:

    数组是零索引的,使用:

    int c = image.getRGB(199, 99);
    

    【讨论】:

      【解决方案2】:

      像素从零开始索引。 试试

      int c = image.getRGB(199, 99);
      

      【讨论】:

        猜你喜欢
        • 2015-04-21
        • 2017-06-30
        • 1970-01-01
        • 1970-01-01
        • 2023-03-13
        • 2021-08-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多