Page 1 of 1

splitcrop and transparency

Posted: 2013-04-22T03:47:31-07:00
by Aezer
Hello,
I want to crop an image into a mosaic of many tiles of the same size. My problem is when a tile exceeds the width (or the height) of the image of origin, I want the tile to be completed with transparency (preserving the fixed size).

Up to now i use the method 'excerpt'. For exemple the code below:

Code: Select all

image.excerpt(-20,-75,256,256)
This code return a tile of 256x256 but fill the unknown pixels with the same as those of the edge of the image. I want the unknown pixels to be transparent.
What is the best way to do this?

Thx (and sorry if my english isn't right) :)

Re: splitcrop and transparency

Posted: 2013-04-22T04:30:22-07:00
by snibgo
At the command line, you might use "-virtual-pixel=none". I don't know the equivalent in whatever language you are using.

Re: splitcrop and transparency

Posted: 2013-04-22T05:15:24-07:00
by Aezer
That works perfectly,
Using RMagick:

Code: Select all

img.virtual_pixel_method = Magick::TransparentVirtualPixelMethod
Thank you !