problem with image rotate RMagick

S

shawn bright

I cant seem to get an image rotate right.
I am using RMagick to do this.

the source image file is transparent with a single red line.

image = Magick::Image.read('public/images/line.png').first
image.rotate!(degrees.to_i)

the problem is that when i do this, every pixel that was transparent
becomes black.

The docs said that this would be the case, but i cannot seem to find
where to override this to preserve the transparency.

thanks for any tips.

sk
 
T

Tim Hunter

Shawn said:
I cant seem to get an image rotate right.
I am using RMagick to do this.

the source image file is transparent with a single red line.

image = Magick::Image.read('public/images/line.png').first
image.rotate!(degrees.to_i)

the problem is that when i do this, every pixel that was transparent
becomes black.

The docs said that this would be the case, but i cannot seem to find
where to override this to preserve the transparency.

thanks for any tips.

sk

Try setting the image's background color to "none" before calling
rotate.
 

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,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top