LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   GIMP: how to make the file transparent to 80%; except the red curve which can stay (https://www.linuxquestions.org/questions/general-10/gimp-how-to-make-the-file-transparent-to-80%3B-except-the-red-curve-which-can-stay-4175700205/)

floppy_stuttgart 09-04-2021 05:30 PM

GIMP: how to make the file transparent to 80%; except the red curve which can stay
 
1 Attachment(s)
Sorry to be here with that topic but the GIMP forum was a nightmare for having an account and asking.
The file in the attachment should be modified 80% transparent, except the red curve. How to do this in GIMP?. Any advice is welcome.
(I am using GIMP under Linux).
I try to see if this gamma function extract will pass through points I have on a JPG picture.
(mathematic visual building things.. and linux.. )

frankbell 09-04-2021 07:29 PM

I have a moderate amount of experience with the GIMP, but mostly editing and enhancing photographs.

The GIMP uses layers. If the background was seen as one layer and the line as a different layer, they could have manipulated the transparency for one layer independently of the other.

Alternatively, they could have first manipulated the transparency of the entire image, then drew or overtraced the line.

A web search for "gimp transparency" will turn up many articles and tutorials. This one looks like a good place to start: https://www.guidingtech.com/image-ba...nsparent-gimp/

Good luck.

ondoho 09-05-2021 12:07 AM

frankbell indirectly makes an important point: if you can get to whatever generated the image, use that instead.
If that should be impossible:
  • Select the appropriate places with e.g. the Select by Color tool (Shift-o). You will have to play with the threshold to get it right.
  • Cut the selection (ctrl-x), then paste it into a new layer.
  • Activate the previous layer that should now contain the background only, and adjust transparency to your liking.

elcore 09-05-2021 01:53 AM

Was doing this a lot, and what ondoho says is correct.

Select by color, copy selection, create new from clipboard, modify the base image, and then paste back from new image.

The thing works great for simple images like the one from OP, but whenever there's something more complex it doesn't always work properly.
For example if you were to select by color in a photo, the resulting selection will almost always have jagged edges and it'd never fit back into original image.
There's a selection (by color) tool which "paints along selection outline" where one can smooth the edge which helps most of the time, but it still leaves a clearly visible gradient along the edge.
So it's no good for photos, but really great for bitmaps.

boughtonp 09-05-2021 09:05 AM


 
Sounds like methods described by Ondoho and Elcore are similar to the first option in the tutorial Frank linked.

Personally, I prefer masks (similar to the second method in the tutorial) - so for a task like this I would start with a Duplicate Layer and setting the bottom one to opacity 20% (i.e. 80% transparent), then with the top layer I'd use a Layer Mask or Alpha Channel to isolate the red line (there's a bunch of options - "Layer > Transparency > Color to Alpha" or "Colors > Components > Decompose" or G'MIC "Channels to Layers" or whatever).

However... if all you want to do is a quick comparison against another image, just resize the smaller image to the same size as the larger, drag the graph into the layer box, and set the Mode to something like Darken should be good enough?


sundialsvcs 09-08-2021 11:28 AM

I would select the shape and then move it to a new "layer" which is "above" the base layer. Now you can adjust the settings of the two layers separately. In general, anything that I might wish to manipulate "together as a group" goes into its own layer.

masterclassic 09-08-2021 12:22 PM

A problem is that the red line in the png file isn't really sharp. It seems like a jpg image converted to png.
I tried by copying the entire image to a new Gimp layer, enhancing the color in that layer only by pushing saturation to the maximum and increasing the contrast. Then I saw that some parts of the line are magenta.
I did select the red + magenta pixels with the "Select by color tool", using the Add button for the two colors. This manner, the selection was the line pixels. After that I did invert the selection and applied the Erase tool to all, leaving the red line intact because out of the selection. Asfter a new selection inversion I applied a fresh red color to the entire selection to turn magenta pixels into red. The remaining of the layer was now empty and transparent (it seems that the alpha channel was automatically activated for that layer.
The background (original image) can be adjusted for transparency as needed, and finally one can export the result as a png file. However I'm not sure if the png conversion keeps the partial transparency.

Of course all this is needed only if one has to present/publish the image. To just observe them in transparency, it would be possible to load both images in separate layers, adjust the size/rotation to align them as needed (not very easy if an accurate work is needed) and adjust the transparency of the upper one.

floppy_stuttgart 12-17-2021 03:05 PM

I wanted to make curve fitting exercises by using existing curves pictures in jpg or png. Now, I make it directly in desmos.com (I gave up GIMP.. I am not so smart).
Thanks to all for the recommendations.


All times are GMT -5. The time now is 12:28 PM.