Page 1 of 1

Make transparent png background in mtPaint. How?

Posted: Thu Jul 08, 2021 11:06 pm
by greengeek

I find it difficult to grasp transparency in graphics tools and could use some advice regarding how to create a "transparent blank canvas" using mtPaint please.

Section 3.3.5 in the mtPaint documentation says:

3.3.5 The Transparent Colour
When editing certain types of file like XPM, GIF or PNG you may wish to have a particular colour set as transparent. To do this you press Ctrl-P for the Preferences window and then go to the Files section and set the palette index you want to be transparent. A setting of -1 will turn transparency off. You also have an opportunity to set this when using the 'Save As' option.

but I don't know if that is applicable to what I am trying to do. (I am not editing - just creating an image from scratch).

I would like to create a new "blank" png, with all pixels transparent - and later overlay coloured pixels as text, lines, shapes, whatever.

TIA for any thoughts/tips!


Re: Make transparent png background in mtPaint. How?

Posted: Thu Jul 08, 2021 11:29 pm
by greengeek

I think I just figured it out:

Make a new file (mtPaint starts with a rectangular black background)
Scale the file to the desired size
Use "File, Save as" and select png but change the "transparency index" from -1 to 0 (zero)

(After the save you can see the black background has changed to grey checkerboard indicating transparency)


Re: Make transparent png background in mtPaint. How?

Posted: Sun Jul 25, 2021 6:09 pm
by Eastler_Dart

You are right :-)

with *.png-Format it works - as long as the transparency-index is >= 0
The transparency-Index is the Color-Number in the "Palette" left side of mtpaint.
As long as the image is in Palette-Format (indexed), you can find the color-index-number for transparency there.
If you choose/change your image to RGB (16 or 24 or 32bit per Pixel), it can happen,
that the colour you want to give transparency isn't in the palette. In that case
open the PaletteEditor(Ctrl+W), in the left column klick the colour-number, where your
transparent-Colour should be stored, then klick the pipette and in the image a Pixel of the transparent-whish-colour.
With "ok" you close the palette-editor and now you see your whished colour in the palette left side
and you can use that palette-colour-number when "save as" in the transparency-index-field.

If you have your image in RGB-Format (=16|24|32bit), you can also set the Alpha-Value
in active-Forground-colour (topleft) to zero, and paint with that colour into your image,
so that those pixel are transparent, or for example set the value to 128 the pixel is half-transparent.
BUT not all PixShowingPrograms do a rgbA-check. In my mtpaint-3.5 I had first switch
in menĂ¼ Channels to EditAlpha, check the box 'set' and klick 'ok'.

Example:
--> open mtpaint new.
--> Menu-Image-'Convert to RGB'
--> Menu-Channels-'Edit Alpha' check 'set' klick 'ok'
--> click topleft in the red carret (aktual Foregroundcolour), change the Alpha-Value from 255 to 64
--> Choose the tool 'Mask selection' drag a carret in the image, a little smaller than the black picture
..............................................................so that there stays at all 4 sides a rest of the black
--> click the 'Fill Selection' - Tool
................................... all pixels in the carret gets the transparency(Alpha) value 64 (to the actual colour there = black)
--> click topleft in the red carret (aktual Foregroundcolour), change the Alpha-Value from 64 to 144
--> Choose the tool 'Mask selection' drag a carret in the image, a little smaller than the transparent-Area
...................................so that there stays at all 4 sides a rest of the black and of the transparent pixels
...................................click the 'Fill Selection' - Tool, all pixels in the carret gets transparency(Alpha)-value 144
--> Menu-File-'save As' select File-Format:'PNG' save the image at a place you can find it
...................................(the transparency-Index can have any value, -1 also works)

you can test the image now for example with Inkscape.
->open Inkscape, paint a big blue carret
->Include the PNG-image (Menu-File-Include)
->move the image over the blue carret,
you can see, that the black colour of the image lets shine through the blue from behind in two different brightness

Now go back to mtpaint.
--> Menu-Channels-'Edit Image' (now - after have used EditAlpha - you can paint with Colours AND different Alpha-Values)
--> click topleft in the red carret (aktual Foregroundcolour), change it to a lightning green and change the alpha-value to 200
--> choose the tool 'Mask selection' drag a carret in the image, over all colours, but keep also areas of the black-Colours with Transparency
--> click the 'Fill Selection' - Tool, all pixels in the carret gets color lightgreen and alpha value 200
--> menu-File-save

to test it, go back to inkscape, delete the first test-image, include the new one, drag it over/around the blue carret.
you see, the green is there, if it stays over the blue, it let shine the blue a little through.

But again, the transparency with the colour-Index-Number in 'save-Image' works nearly everywhere, but only 100% transparent or not transparent and only for one single colour.
With the Alpha-value you can give more than only one colour transparency, and in addition fine-tuned transparency from 0(100%) to 255(no transparency), but not all software respect alphavalues.

Hope it helps a little