How to cut a picture in its transparency?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

How to cut a picture in its transparency?

Post by ZeitenWanderer » Wed Oct 29, 2014 6:43 pm

Imagine a transparent gif, two stamps are photographed. Now, would anyone have an idea hot to cut this picture into two, right in the middle of the transparency between these two?

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: How to cut a picture in its transparency?

Post by JRL » Thu Oct 30, 2014 4:35 am

An idea.

Put a solid color dialog behind the transparent gif. Use GetPixelColor> from the left moving right until you run into a color not the dialog's solid color. Then move from the right to the left until you run into a color not the dialog's solid color. Average the two X positions for the center X pos. Use ScreenCapture> to select the two images based on the three acquired X positions. Then convert the two resulting BMP files back to GIFs using your favorite image conversion tool making the dialog's solid color the transparent color for the GIFs.

ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

Re: How to cut a picture in its transparency?

Post by ZeitenWanderer » Fri Nov 07, 2014 9:47 am

I am not making progress on this one, maybe my explanation was too fuzzy.

Image

As one can see, these pictures are not always neat and straight and there might be a shadow in the corner. Instead of making them transparent in the beginning, I left them on the origginal ground. It would be possible the avoid the shadow and also to straighten these pictures, but in that case the script would not be of much help anymore.

So first of all, how would one cut out these three pictures into three single ones? A bit of code would be appreciated.

Getpixelcolor would not help, since I do not know where the next set of pictures will be. Any idea anyone?

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: How to cut a picture in its transparency?

Post by JRL » Fri Nov 07, 2014 10:34 pm

Wow... you're not making this easy! Since the background is not a solid color we would need to search for a range of colors. Not sure how to do that. I'm sure it could be done but a Macro Scheduler script might be very slow to process something like that. This could turn out to be a perfect application for the newPython code processing ability.

Do all of your pictures have the same green background? Looks like a photo was taken while the stamps were laid out on a piece of green felt.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts