I am trying to open a greyscale image in *.data format in GIMP, but the only options that I get are multichannel (RGB, RGB alpha, etc.). Is there a way to change this? Thanks.
File->Open
Choose Raw image data as the file type and find your .data file and open it.
In the proceeding Load Image From Raw Data dialog, set the Image Type to Indexed. Set the Offset to 0 and the Width and Height to the correct dimensions for your data. Leave everything under the Palette section as defaults.
Open in RGB and change Image > Mode > Greyscale?
Related
I am using GIMP 2.10.24. I have some image and I need to change Print Size Width to 21mm and Height to 30mm.
I can do that with Set Image Print Resolution Dialog (Menu->Image->Print Size):
screenshot
But there is my question: how could I do that using script-fu or python-fu?
Print size, size in pixels, and print definition are completely related:
print size = size in pixels รท print definition
So to change the image print definition you use
In Python:
pdb.gimp_image_set_resolution(image, xresolution, yresolution)
In Script-fu:
(gimp-image-set-resolution image xresolution yresolution)
In both case the X/Y resolutions are in dots per inch.
However if you are using Gimp just for this creating a Gimp script is overkill (the learning curve is quite steep). If the image is in a common format (JPEG, PNG, TIFF) the print definition is part of the image metadata (JPEG header, or EXIF data) and can be changed directly without decoding/reencoding the image using CLI utilities. For instance with ExifTool:
exiftool ${your_image} -xResolution=321 -yResolution=321
I'm using the following code to successfully create an icon with Python-Fu in GIMP:
pdb.gimp_palette_set_background('green')
image = pdb.gimp_image_new(256, 256, RGB)
image.new_layer(pos=1, fill_mode = BACKGROUND_FILL)
fileName = 'C:\\favicon.ico'
pdb.file_ico_save(image, None, fileName, fileName)
pdb.gimp_image_delete(image)
When I export an image as .ico manually, I can set different properties like compression, bpp, alpha-bits, color palette etc. Per default, the largest layer will be saved using compression, which is not recommended. Manually, I can uncheck compression. But saving an icon programmatically with pdb.file_ico_save does not offer those settings.
So how can I set different properties of the icon layers, when saving the icon with pdb.file_ico_save?
To judge from what I think is the source code: https://gitlab.gnome.org/GNOME/gimp/-/blob/gimp-2-10/plug-ins/file-ico/ico-save.c
uou can't control those parameters. It looks like the code tries to make intelligent guesses as to the correct values to use, for example compression if the width|height is greater than 255
This is what an image marked as a "normal image" looks like in Unity:
When I import this image into GIMP, this image appears like this:
I guess a big part of the image is stored in the alpha channel, and GIMP doesn't display it.
At first, I thought it was only a display problem, but when I then export it from GIMP and import it into Unity, the image looks like this:
(Yes, I have flipped it).
As one can see, the alpha channel is gone.
How could I tell GIMP to preserve it?
Thank you!
Edit: Here is some more information:
The image is a .TIFF.
If I save the edited image using "Overwrite ", then the background gets killed.
Then I try "Export as", and I choose "PNG". I leave "Save color values from transparent pixel" checked, and I leave the selection below at "Automatic pixel format". This also removes the "background".
What else could I try?
You don't say how you are exporting the image back from GIMP - but if you use the export as... dialog, upon choosing to export to .png, there is a save color values from transparent pixels checkbox.
Just check it before confirming the export.
(It won't show if you just click on export to NAME to write the same image back - you have to do export as... and select the same name for the dialog to apear).
Also, it is not that part of the image is stored in the alpha channel The alpha channel just contains opacity data - in this case, it contains a maks for regions of full-opacity/full-transparency for the shown region. GIMP's normal saving mechanism will erase the color data in the fully transparent areas to save image size upon exporting.
If you are using other image formats than PNG, GIMP does not have the option to preserve the data in transparent areas - the workarounds would be exporting to PNG and then converting to PNG with another tool (which might or not preserve these data), or raising the alpha-channel values to "1" instead of "0" before exporting in GIMP (can be done with colors->levels or colors->curves)
In my app, I convert and process images.
from colour to greyscale, then doing operations such as histogram-equalisation, filtering, etc.
that part works fine.
my UIImage display correctly, I also save them to jpeg files and it works.
The only problem is that, although my images are now greyscales, they are still saved as RGB jpegs. that is the red, green and blue value for each pixel are the same but it still waste space to keep the duplicated value, making the file size higher than it could be.
So when i open the image file in photoshop, it is black & white but when I check "Photoshop > Image > Mode", it still says "RGB" instead of "Greyscale".
Anyone know how to tell iOS that the UIImageJPEGRepresentation call should create data with one channel per pixel instead of 4?
Thanks in advance.
You should do an explicit conversion of your image using CGColorSpaceCreateDeviceGray() as color space which is 8 bits per component, 1 channel.
I want to convert some animated PNG (APNG) images to animated GIF. I can successfully convert with a utility I found on the web called apng2gif. Expertly named if I may say. The problem is it does not convert the images with sufficient color depth so the output is a little bit to pixelated and not so smooth relative to the original.
Does anyone know of any other image converters that might convert APNG to GIF with more that 16 bit color depth?
The problem is not with the converter, but with GIF format itself:
http://en.wikipedia.org/wiki/Graphics_Interchange_Format
The format supports up to 8 bits per pixel thus allowing a single image to reference a palette of up to 256 distinct colors.
If you need the GIF to blend better with the background, click on Settings button in apng2gif and then choose the background color you want.