Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

delphi - 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. :(

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...