Firebase Extension: Resize Images not limiting PNG colors - sharp

Limiting the colors does not work for PNG with transparency in my case.
The resulting PNG does not go down to 8-Bits-Per-Pixel.
Configuration
According to the Sharp docs and the Firebase example, the output options below should work.
colours vs. colors is not an issue here.
{ "png" : { "colours":256 } }
https://sharp.pixelplumbing.com/api-output#png
Screenshot of PNG details processed by Firebase Image Resizer extension
Tested for faulty base image
pngquant is able to reduce the base PNG with transparency to 256 colors.
The base image is not faulty.

Related

How do I know if a color image has color separation?

I am using a content creation website. This website only allows me to upload a jpg or tiff image as a cover picture for my content. Furthermore, the uploaded image must have an RGB color profile and must not have color separation.
So, I need to know how to check if a colored JPG image has color separation or not. If it does have color separation, how to remove the color separation? Any ideas?

How can I convert PNG to GIF keeping the transparency?

How can I convert PNG to GIF keeping the transparency?
I would have hoped that using the Assign( ) method would work but it doesn't seem to migrate transparency. In the GIF, it's represented as black.
png:=TPngImage.Create;
try
png.LoadFromFile(sFile);
// comes from file: png.TransparencyMode;
// comes from file: png.Transparent
// didn't help: gif.Transparent:=true;
gif.Assign(png);
// didn't help: gif.Transparent:=true;
gif.SaveToFile('e:\tmp\out.gif');
finally
png.Free;
end;
I haven't found a way to handle this in Delphi...
thanks!
It is possible to transfer an image from a PNG to a GIF. However, I don't recommend that you do so. The GIF format is substantially less capable than PNG. PNG supports RGBA color channels and partial transparency. GIF uses a 256 color palette and no support for partial transparency.
There are many libraries available that will make the best of a bad job and attempt to produce a GIF image that is close to the PNG image, but information will be lost.
The GIF format dates from the late 1980s and time has moved on. It has long since served its purpose. PNG is modern, capable and well supported. If it is possible to do so you should switch from GIF to using PNG.

Delphi - Resize PNG with transparence and index

I have many PNG files with transparency and these PNG fiels seem to be indexed.
I would like to :
Put 2 identical PNG side to side with a space between both
Resize the result with a smooth resize filter (or Mitchell, Linear, Spline or other)
Keep transparency and originals colors
Do you have an example to do that ?
This question is related to other PNG resize questions but...
AFAIK, You can't resize an indexed image and keep the original palette. Resizing the image will necessitate the mixing of colors, especially in reducing the image.
The original author of the PNGImage component (the basis of the Delphi native component) had a forum where he, and others, posted code snippets on how to do things using the PNGImage component.
Before the forum was taken down I grabbed a copy of all of the code snippets and placed them on the CodeGear Code Central website.
Most if not all of these work with native PNG images and do maintain the Alpha channel.
Here is the complete list of examples included in the package:
Smooth rotates a PNG object
Resizes a TPNGObject using a smooth algorithm
Slice one PNG into several smaller ones
Saves an image as either a bitmap or a png.
Sample chunk descendant
Read all tEXt-Chunks and write values into a TStrings object
Display a message box with information extracted from the PNG File
Finds and cuts a block from a PNG image
This method converts the png into a jpeg object
This method converts the png into a bmp object
Overlay one PNG over another (This makes the image half transparent)
Flips a png image vertically and saves back
Draws a png image over the desktop
Here is the link: CodeCentral PNG Methods

Availability of background transparency for jpeg images

I need to edit a png image,by giving it border and drop shadow effect. But the final size of the edited image is too high to use for a mobile app .I know that size of jpeg is less compared to that of png.So i convert that image to jpeg and tried to give drop shadow and border effect.But that image is not having transparent background..Is their any other methods to accomplish this using jpeg?
Another option is to try either ImageOptim for losseless compression, or its lossy cousin, ImageAlpha.
ImageOptim tries a series of lossless algorithms to shrink a PNG and selects the smallest result of the bunch. It has taken 25% to 50%+ of quite a few of our images.
ImageAlpha, on the other hand, is lossy and can further crunch the image, with results more like JPEG but without losing Alpha.
You would also do well to disable PNG compression in Xcode as shown here, with additional details here.
What #minitech wanted to say is not about scaling, it's about file compression. jpg and png files usually have some data that could be removed from the file. There are some compression methods to reduce file size (note that is size in kbs, not in scale measurement). Jpg images can reduce file size by reducing image quality, too.
If you want another file type that accepts transparency, there are the gif format, which gives you a smaller file, but have some drawbacks, like a lack of alpha channel (variable transparency). Check this link for more details: http://www.w3.org/QA/Tips/png-gif
There are a couple of online file compressors. If you want to compress png files, you could try using http://tinypng.org/
No, jpeg image wont support transparency.But you can change the white background coming along with jpeg image

Convert apng to gif with sufficiant resolution and color depth

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.

Resources