GIMP Chat http://gimpchat.com/ |
|
Clipping and Alpha using two generated source images http://gimpchat.com/viewtopic.php?f=8&t=18395 |
Page 1 of 1 |
Author: | mystrzy [ Sat May 30, 2020 2:34 pm ] | |||
Post subject: | Clipping and Alpha using two generated source images | |||
GIMP Version: 2.8.14 Operating System: Windows GIMP Experience: Basic Level So I have a open-source tool that extracts images from pdf files that I own for my own personal, non-commercial purposes. Two files of interest are generated (see attached), image and mask. I'd like to use the mask file to delimit the image file, just the image area under the white mask will make it through. After that process, the area corresponding to black on (another duplicate copy of ?) the mask will be converted to alpha and saved. The end result will be a nicely cleaned up image with an alpha channel background, stored as a png... all without manually brushing or erasing anything with a mouse. Just menu/button selections.
|
Author: | racer-x [ Sat May 30, 2020 3:09 pm ] |
Post subject: | Re: Clipping and Alpha using two generated source images |
Just add a layer mask to your image and copy and paste your mask image into the layer mask, then save as a png. Attachment: mask.png [ 505.9 KiB | Viewed 3078 times ] |
Author: | mahvin [ Sat May 30, 2020 5:48 pm ] |
Post subject: | Re: Clipping and Alpha using two generated source images |
racer-x wrote: Just add a layer mask to your image and copy and paste your mask image into the layer mask, then save as a png. Attachment: mask.png Mystrzy: GIMP has changed the way we save files, so actually use the Export As option is the same as saving the file as... it takes a little getting used to, just so you know. |
Author: | mystrzy [ Sat May 30, 2020 6:55 pm ] | ||
Post subject: | Re: Clipping and Alpha using two generated source images | ||
Your image looks good. However, there is a lot going on in that one sentence description. "Just add a layer mask to your image and copy and paste your mask image into the layer mask, then save as a png." I've opened the image, it shows as one layer labeled as {the filename}. I right-click on the layer, select "Add layer mask...", and 1/2 a shton of options appear.. which one to choose? let's pick the alpha one ..continuing on.. Now the layer has two boxes on it, the image and the layer-mask. "Just add a layer mask to your image and copy and paste your mask image into the layer mask, then save as a png." So I can't just drag the mask-file into the layers.. I open the mask-file into a separate session/window so its by itself. I "Select> All" and then "Edit> Copy", it's now in the clipboard. Now.. "into the layer mask". How the heck do I paste into just the layer-mask portion of that layer? Hmmm, I click on the the layer-mask box on the right of the two boxes on that layer, it's now got a white outline. Then I paste into what looks like a sea of alpha (because of my earlier choice)... and BAM! there it is! Now I exported as png. Done. (I tried a few times and I actually didn't have this done and working until I went thru the exercise of recording this step by step.) Thank You for stepping up and your help! There are so many options and capabilities in GIMP that it can be hard to know which to use and in what order and/or options. Again, Thank You.
|
Author: | racer-x [ Sat May 30, 2020 8:15 pm ] |
Post subject: | Re: Clipping and Alpha using two generated source images |
Glad you figured it out, I knew you would. I'm good at doing, but not so much at explaining. |
Author: | rich2005 [ Sun May 31, 2020 2:33 am ] |
Post subject: | Re: Clipping and Alpha using two generated source images |
The small print: "File comment: Image file to be cleaned up by mask file, and alpha added.. eventually automated." Easy enough one at a time....eventually automated ...is less easy. It should be possible to write a Gimp script that will batch process pairs of images but a better tool for this is commandline Imagemagick (IM). Still needs wrapping in a batch / bash file with file names replaced by variables, the basic command is Code: Select all magick image-0007.png image-0008.png -alpha Off -compose CopyOpacity -composite masked.png gives this: Attachment: masked.jpg [ 124.22 KiB | Viewed 3008 times ] see: http://www.imagemagick.org/Usage/masking/#masks note: IM6 uses convert IM7 uses magick |
Author: | racer-x [ Sun May 31, 2020 5:15 am ] |
Post subject: | Re: Clipping and Alpha using two generated source images |
That's an interesting way to do it Rich. I'll bet that ffmpeg can do it too with the proper script. I still think its a lot easier to do it in Gimp, especially if you need to edit the mask. |
Author: | rich2005 [ Sun May 31, 2020 5:21 am ] |
Post subject: | Re: Clipping and Alpha using two generated source images |
Agreed if you want to do one at a time. There is a script that helps with the layer mask: One of Saul Goodes scripts copy-mask-from-above.scm http://chiselapp.com/user/saulgoode/rep ... from-above Does what it says. Saves having to - add layer mask / copy / paste / anchor |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |