Skip to main content

8-bit grayscale - pixel manipulation

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
ehsun7b
Offline
Joined: 2006-08-15

How can I access individual pixels of an 8-bit grayscal JPEG? And how can I alter those pixels using JAI?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
quake4ialdaris1
Offline
Joined: 2007-06-14

If you want fast/direct access then you can access the BufferedImage's
Raster's data

through bi.getRaster.getDataBuffer()

for an 8-bit grayscale I believe JAI will create a DataBufferByte, you'll
need to cast the parent "DataBuffer" to the child class to access the byte
array directly...

You may need to retrieve the data in banks..

Regards,
Alessandro Ferrucci

On Fri, Apr 22, 2011 at 2:26 PM, wrote:

> How can I access individual pixels of an 8-bit grayscal JPEG? And how can I
> alter those pixels using JAI?
>
>