This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes BufferedImage TYPE_CUSTOM  to 	TYPE_INT_ARGB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "BufferedImage TYPE_CUSTOM  to 	TYPE_INT_ARGB " Watch "BufferedImage TYPE_CUSTOM  to 	TYPE_INT_ARGB " New topic
Author

BufferedImage TYPE_CUSTOM to TYPE_INT_ARGB

Arron Ferguson
Greenhorn

Joined: Feb 01, 2005
Posts: 28
Hey all,

I'm trying to load a PNG image in that has transparency in it using JDK 1.6 u10 and manipulate the image data (pixels). The problem is if I do this:



Or this:



Or this:



The type is always TYPE_CUSTOM and not TYPE_INT_ARGB - which seems odd because the PNG file that I am loading has transparency in it.

What I want is the BufferedImage (which has the PNG image data I'm interested in) so that I can play with the image data (e.g. perform a projective transformation) :




Any advice would be greatly appreciated!
Arron Ferguson
Greenhorn

Joined: Feb 01, 2005
Posts: 28
Here's the funny thing ...

I tried this:


And it drew a black pixel ... which means that it is in fact TYPE_INT_ARGB not TYPE_CUSTOM. Funny those Sun engineers wouldn't call it what it is but treat it as it is.

Arron Ferguson
Greenhorn

Joined: Feb 01, 2005
Posts: 28
Okay this is the last post from me in this thread - I just figured I would share so as to help anyone else from making the same mistake. The PNG with transparency is correctly set to TYPE_INT_ARGB (i.e. with alpha). What I did wrong (and it was my fault), was that I made the following instance method call in the class GraphicsConfiguration:

gc.createCompatibleImage(w, h, Transparency.BITMASK);

This resulted in being considered a "TYPE_CUSTOM " BufferedImage. As soon as I said:

gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);

The BufferedImage.getType returned TYPE_INT_ARGB (== 2)

Sorry for all the posts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BufferedImage TYPE_CUSTOM to TYPE_INT_ARGB