Changing colors of a gif image

T

Todd

Hello again,

I got the .gif file that I have to be transparent in the correct
locations. Now, I would like to change the colors of the remaining
pixels based upon an input color.

I have looked at ConvolveColorOp, but don't understand how to define a
ColorSpace to convert, say black to blue. Maybe I am missing
something quite simple, but ...

I have looked at RescaleOp, but get an error stating "Rescaling cannot
be performed on an indexed image." I was probably on the wrong path
here anyway - I set all the scales to zero and then used the RGB
values of the input color as the offsets, me thinks that this will
give a single colored block.

I have spent way too many hours trying to decipher the Java tutorials,
which are surprisingly sparse when it comes to ConvolveColorOp, so I
am asking for help from you guys.

Any thoughts on how to change pixel colors within a .gif file are
appreciated,
Todd
 
K

Knute Johnson

Todd said:
Hello again,

I got the .gif file that I have to be transparent in the correct
locations. Now, I would like to change the colors of the remaining
pixels based upon an input color.

I have looked at ConvolveColorOp, but don't understand how to define a
ColorSpace to convert, say black to blue. Maybe I am missing
something quite simple, but ...

I have looked at RescaleOp, but get an error stating "Rescaling cannot
be performed on an indexed image." I was probably on the wrong path
here anyway - I set all the scales to zero and then used the RGB
values of the input color as the offsets, me thinks that this will
give a single colored block.

I have spent way too many hours trying to decipher the Java tutorials,
which are surprisingly sparse when it comes to ConvolveColorOp, so I
am asking for help from you guys.

Any thoughts on how to change pixel colors within a .gif file are
appreciated,
Todd

There is no ConvolveColorOp. There is a ConvolveOp and a
ColorConvertOp. Neither of which are particularly suited to what you
want to do.

Load your GIF image into a BufferedImage object and modify the pixels
directly and then either display it or write it to permanent storage.
 
A

Andrew Thompson

I got the .gif file that I have to be transparent in the correct
locations.

If this is related to the 'upwards/downwards
pointing triangle' type graphics you mentioned
on another thread, it might be a better strategy
altogether to render the graphic on the fly, using
a custom component, rather than use images at all.

(I had only thought of that after posting the
earlier messages.)

Andrew T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top