Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resize PNG image

HI! Could you please tell me how to resize a .png image. Or better give an example. I've been searching for the answer for a long time and it seems that nobody knows how to resize a .png image and keep its transparency. :(

like image 961
serhiyiv Avatar asked Mar 13 '10 08:03

serhiyiv


People also ask

How do I resize a PNG without losing quality?

To resize a PNG file without losing quality, use a lossless compression tool that supports transparency and PNG files. There are many compression tools available online that can do this for free.

How do I make a PNG file high resolution?

Select File > Export as > PNG from the menu. Change the Zoom to a higher percentage, 200% or 300%, for example. Set the other options as you need, then click Export. When you use the PNG image in a document or on the web, restrict its dimensions to effectively display the image at a higher resolution (DPI).


1 Answers

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

like image 187
Vivian Mills Avatar answered Oct 04 '22 20:10

Vivian Mills