splitcrop and transparency

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Aezer
Posts: 2
Joined: 2013-04-22T03:20:01-07:00
Authentication code: 6789

splitcrop and transparency

Post 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) :)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: splitcrop and transparency

Post by snibgo »

At the command line, you might use "-virtual-pixel=none". I don't know the equivalent in whatever language you are using.
snibgo's IM pages: im.snibgo.com
Aezer
Posts: 2
Joined: 2013-04-22T03:20:01-07:00
Authentication code: 6789

Re: splitcrop and transparency

Post by Aezer »

That works perfectly,
Using RMagick:

Code: Select all

img.virtual_pixel_method = Magick::TransparentVirtualPixelMethod
Thank you !
Post Reply