Questions tagged [png]

PNG (Portable Network Graphics) is an image file format designed to store raster graphics. It is associated with ".png" file extension. Use this tag for questions involving this specific format.

PNG was created to improve upon and replace (Graphics Interchange Format) as a losslessly compressed image file format not requiring a patent license.

PNG supports palette-based images with transparency, true colour images with or without alpha channel (RGB, RGBA), and grayscale images; PNG supports channel depths from 1-bit to 16-bit per channel. Interlacing, which allows the progressive display of partially downloaded images, is implemented via the Adam7 algorithm. Animation is supported by way of the extension.

More information

6735 questions
17
votes
6 answers

How to change the colors of a PNG image easily?

I have PNG images that represent playing-cards. They are the standard colours with Clubs and Spades being blank and Diamonds and Hearts being red. I want to create a 4-colour deck by converting the the Clubs to green and the Diamonds to blue. I…
theblitz
  • 6,683
  • 16
  • 60
  • 114
17
votes
2 answers

How to convert a png file to xml resource by Android?

I want to convert my png file to xml resource that can be accepteed by android. I converted it by using the website below. https://convertio.co/fr/png-svg/ Then I downloaded it then put it in resource directory and changed type to xml, but android…
Lina Hammami
  • 373
  • 1
  • 4
  • 22
17
votes
3 answers

Adding a picture to plot in R

I'm trying to add a picture (jpeg,png doesn't care) to a plot which is defined by the layout function. For example: a<-c(1,2,3,4,5) b<-c(2,4,8,16,32) m <- matrix(c(1,1,1,1,2,3,2,3), nrow = 2, ncol = 4) layout(m);…
LarsTap
  • 173
  • 1
  • 1
  • 4
17
votes
2 answers

How to install libpng-dev on windows?

I am trying to install the imagemin-pngquant module for node : https://www.npmjs.org/package/imagemin-pngquant However, when I run the command npm install imagemin-pngquant --save-dev I get the below error: warn : pngquant pre-build test failed …
Rich
  • 5,603
  • 9
  • 39
  • 61
17
votes
3 answers

Pure JavaScript image manipulation

I have a use case where I want to created (a) a Node application that (b) performs basic image manipulations (PNG resize and crop) but (c) where I cannot have external dependencies like native libraries, GraphicsMagick, ImageMagick, PhantonJS,…
Oliver Moran
  • 5,137
  • 4
  • 31
  • 45
17
votes
1 answer

How is PNG CRC calculated exactly?

For the past 4 hours I've been studying the CRC algorithm. I'm pretty sure I got the hang of it already. I'm trying to write a png encoder, and I don't wish to use external libraries for the CRC calculation, nor for the png encoding itself. My…
MythicManiac
  • 445
  • 1
  • 4
  • 11
17
votes
7 answers

Converting PNG into JPEG

I'm having problems converting a simple PNG into a JPEG format. I'm using the following code: ... File png = new File(filePath); try { SeekableStream s = new FileSeekableStream(png); PNGDecodeParam pngParams = new…
Norberto
  • 185
  • 1
  • 2
  • 7
17
votes
3 answers

Python: default/common way to read png images

I haven't found a standard way in Python to read images. Is there really none (because there are so many functions for so many custom stuff that I really wonder that there are no functions to read images)? Or what is it? (It should be available in…
Albert
  • 65,406
  • 61
  • 242
  • 386
17
votes
1 answer

How can I remove the strange white margin around my .png (plotted with r, ggplot)?

I save plots with ggplot as .png. The background has to be black, but there is allways a small white margin (only top, down an left; not right). How can I remove this margin? Thank you! Here is my Code library(ggplot2) require(grid) dat <-…
Markus Germar
  • 223
  • 2
  • 6
17
votes
1 answer

Convert 32 bit png to 8 bit png with ImageMagick by preserving semi transparent pixels

I want to convert 32 bit png to 8 bit png with ImageMagick, but semi transparent pixels are lost. How to solve this problem? The command that I am using is the following convert original.png PNG8:output.png
Karmar
  • 570
  • 1
  • 6
  • 15
17
votes
3 answers

Alpha transparent PNGs not displaying correctly in Mobile Safari

I'm using some semi-transparent PNGs as background-images on various websites. These are usually something like a 1x1 image with a 30-percent opaque white layer. I've noticed that Mobile Safari does not display them correctly, giving them a…
worksology
  • 885
  • 2
  • 8
  • 13
17
votes
1 answer

Loading PNG files directly from URL

I am using the png package to load PNGs as raster images, and then plotting them. The PNGs are coming from an online source, namely, Wikipedia. I can get the following to work: library(png) pngURL <-…
isDotR
  • 1,021
  • 2
  • 12
  • 23
16
votes
3 answers

Convert a PDF to a Transparent PNG with GhostScript

I am attempting, unsuccessfully, to use Ghostscript to rasterize PDF files with a transparent background to PNG files with a transparent background. I've searched high and low for questions from others attempting the same thing and none of the…
Jonathon Wolfe
16
votes
3 answers

A button control and underlying replacement for TBitmap that properly handles PNG transparency without writing pre-blend code

Delphi 2010's TSpeedButtons did not seem to really support PNG transparency properly, because the Glyph property uses a TBitmap internally, and TBitmap is for bitmaps, and doesn't support PNG transparency properly, and TSpeedButton.Glyph can't…
Warren P
  • 65,725
  • 40
  • 181
  • 316
16
votes
4 answers

Javascript generate transparent 1X1 pixel in dataURL format

I would like to know a way to generate a single pixel in JavaScript converting it to base64. The ideal function would be: function createPixel(hexColor, opacity){ //...Calculate return base64DataURL; } I am not very familiar with image…
user654628
  • 1,429
  • 1
  • 17
  • 37