Skip to main content

[JAVA2D] Questions about image type and jpegs

1 reply [Last post]
Anonymous

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chet Haase

Re-send: the list server bounced it a few days ago...

Chet.

Chet Haase wrote:
>
> Hi Rick,
>
> A good general approach is to copy any image into the image type
> you'd actually like to use. For example, if you are going to
> be using an image as a source for copies to the Swing window or
> to other images, create a compatible image:
>
> gc.createCompatibleImage(w, h)
> where (w,h) come from the dimensions of your loaded image and
> gc is a suitable GraphicsConfiguration.
>
> Once you have an image in the type you desire, just get the
> Graphics for it and copy the original image into it:
>
> Graphics g = newImage.getGraphics();
> g.drawImage(originalImage, 0, 0, null);
>
> Then just use newImage instead of your original image...
>
> Chet.
>
>
> Rick Root wrote:
>
>> I'm trying to do some image manipulation of some jpegs using java code
>> running on jre 1.4.2_11
>>
>> When I call the getType() method on the BufferedImage objects after
>> loading the jpeg images.. they will sometimes return a value of 0
>> (TYPE_CUSTOM).
>>
>> I have a hard time manipulating these images.
>>
>> I did a little testing with an image using Photoshop 7 and a picture
>> from my digital camera. I saved 3 copies of it... all the standard
>> settings for a jpeg... but with different Format settings.. Baseline
>> "Standard", Baseline "Optimized", and Progressive.
>>
>> The first two end up with an image type of 0, while the progress jpeg
>> seems to be the only one I can work with. It returns an image type of
>> 5.
>>
>> So, my question is... since I can't manipulate images with custom
>> image types.. how do I deal with this using standard java2d apis
>> included with Java 1.4.2?
>>
>> Rick
>>
>> ===========================================================================
>>
>> To unsubscribe, send email to listserv@java.sun.com and include in the
>> body
>> of the message "signoff JAVA2D-INTEREST". For general help, send
>> email to
>> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".