How to cut a picture in its transparency?
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 68
- Joined: Wed Dec 07, 2005 7:13 am
How to cut a picture in its transparency?
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?
Re: How to cut a picture in its transparency?
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.
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.
-
- Pro Scripter
- Posts: 68
- Joined: Wed Dec 07, 2005 7:13 am
Re: How to cut a picture in its transparency?
I am not making progress on this one, maybe my explanation was too fuzzy.
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?
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?
Re: How to cut a picture in its transparency?
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.
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.