png

Split PNG into RGB and Alpha Channels

时间秒杀一切 提交于 2019-12-19 04:16:04
问题 I'm trying to do some automated processing of PNG files that takes in an RGBa .png file and outputs two jpeg files: 1 that is just the RGB channels and the other that is just the alpha channel, as a greyscale image. Is there any way to do this in C# natively? If a third party library is required, that is fine as long as it's free/open source, but I would prefer to just do it directly with GDI or something. 回答1: Here is my working code: /// <summary> /// Split PNG file into two JPGs (RGB and

Convert DOC / DOCX to PNG [closed]

拥有回忆 提交于 2019-12-18 18:53:47
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I am trying to create a web service that will convert a doc/docx to png format. The problem I seem to have is I can't find any library or something close to it that will do what I need, considering I am looking for something free and not Office dependent (the server where the app will run does not have Office

Delphi, GR32 + PngObject: converting to Bitmap32 doesn't work as expected

安稳与你 提交于 2019-12-18 16:57:20
问题 I'm using GR32 for drawing multiple semi-transparent PNG images. So far I've been using the following method: png:= TPNGObject.Create; png.LoadFromFile(...); PaintBox321.Buffer.Canvas.Draw(120, 20, png); however I wanted to switch to the method proposed on GR32 website (http://graphics32.org/wiki/FAQ/ImageFormatRelated) : tmp:= TBitmap32.Create; LoadPNGintoBitmap32(tmp, ..., foo); tmp.DrawMode:= dmBlend; PaintBox321.Buffer.Draw(Rect(20, 20, 20+ tmp.Width, 20+tmp.Height), tmp.ClipRect, tmp);

Delphi, GR32 + PngObject: converting to Bitmap32 doesn't work as expected

夙愿已清 提交于 2019-12-18 16:57:04
问题 I'm using GR32 for drawing multiple semi-transparent PNG images. So far I've been using the following method: png:= TPNGObject.Create; png.LoadFromFile(...); PaintBox321.Buffer.Canvas.Draw(120, 20, png); however I wanted to switch to the method proposed on GR32 website (http://graphics32.org/wiki/FAQ/ImageFormatRelated) : tmp:= TBitmap32.Create; LoadPNGintoBitmap32(tmp, ..., foo); tmp.DrawMode:= dmBlend; PaintBox321.Buffer.Draw(Rect(20, 20, 20+ tmp.Width, 20+tmp.Height), tmp.ClipRect, tmp);

Can you force ImageMagick to use PNG-8 alpha transparency?

喜夏-厌秋 提交于 2019-12-18 15:03:25
问题 When I try to run a bunch of PNG-8 images with alpha transparency through Imagemagick, it converts them to PNG-32, increasing the file size a lot. Is it possible to force Imagemagick to keep my image type as 8-bit PNG? 回答1: You can do it like this: convert test.png PNG8:test2.png I've had varying luck with IM and PNG8, but this is the correct way to do it. 回答2: I seem to get the best result using the following convert src.png -colors 256 PNG8:dest.png 来源: https://stackoverflow.com/questions

Add border around png image using imagick PHP

邮差的信 提交于 2019-12-18 14:54:00
问题 How can I add a border around a png image? Whenever I try to add a border using borderImage function available in imagick it loses its transparency if it is a png image. <?php $image = new Imagick(); $image->readImage('tux.png'); $image->BorderImage(new ImagickPixel("red") , 5,5); // send the result to the browser header("Content-Type: image/" . $image->getImageFormat()); echo $image; This is the original image: and this is after adding a border: Border color is also applied onto the

Can I programmatically determine if a PNG is animated?

萝らか妹 提交于 2019-12-18 14:50:20
问题 I have PNG (as well as JPEG) images uploaded to my site. They should be static (i.e. one frame). There is such thing as APNG. (it will be animated in Firefox). According to the Wikipedia article... APNG hides the subsequent frames in PNG ancillary chunks in such a way that APNG-unaware applications would ignore them, but there are otherwise no changes to the format to allow software to distinguish between animated and non-animated images. Does this mean it is impossible to determine if a PNG

How can I convert a PNG file to PDF using java?

≡放荡痞女 提交于 2019-12-18 13:39:07
问题 Are there any open source libraries that I can use? 回答1: itext may help you. you don't really convert a png to pdf but create a pdf with a png in it. simple example: Document document = new Document(PageSize.A4, 20, 20, 20, 20); PdfWriter.getInstance(document, new FileOutputStream("C:/test.pdf")); document.open(); Image image = Image.getInstance(getClass().getResource("/logo.png")); document.add(image); document.close(); 回答2: An example which rotates the page, if landscape mode fits better /*

how to cast an array of char into a single integer number?

你。 提交于 2019-12-18 13:28:20
问题 i'm trying to read contents of PNG file. As you may know, all data is written in a 4-byte manner in png files, both text and numbers. so if we have number 35234 it is save in this way: [1000][1001][1010][0010]. but sometimes numbers are shorter, so the first bytes are zero, and when I read the array and cast it from char* to integer I get wrong number. for example [0000] [0000] [0001] [1011] sometimes numbers are misinterpreted as negative numbers and simetimes as zero! let me give you an

Importing PNG files into Numpy?

邮差的信 提交于 2019-12-18 12:45:51
问题 I have about 200 grayscale PNG images stored within a directory like this. 1.png 2.png 3.png ... ... 200.png I want to import all the PNG images as NumPy arrays. How can I do this? 回答1: Using just scipy, glob and having PIL installed ( pip install pillow ) you can use scipy's imread method: from scipy import misc import glob for image_path in glob.glob("/home/adam/*.png"): image = misc.imread(image_path) print image.shape print image.dtype UPDATE According to the doc, scipy.misc.imread is