Emacs under Windows and PNG files - windows

Would anyone have any pointers on getting PNG images to display in Emacs 23 under Win32?.. I have installed the gnuwin32 set of utilities, including libpng and zlib; C:\Program Files\GnuWin32\bin is in path. JPG files started working but not PNGs. I'd appreciate any hints on getting this to work.
EDIT: PNG thumbnails actually display fine (e.g. in dired via C-t C-t). However, opening them fails (opens as garbage in fundamental mode, and M-x image-mode says "invalid image specification").

You have to copy one of these dlls "libpng12d.dll" "libpng12.dll" "libpng.dll" "libpng13d.dll" "libpng13.dll" to your emacs-23.1/bin/ directory. They require zlib1.dll which you have to copy as well. I did the same thing for jpeg62.dll and giflib4.dll and now my emacs supports jpg, gif and png files. For some reason it does not work if I simply put these dlls in the path.
You can check (image-type-available-p 'png) to see if png is supported. image-library-alist maps image type to a list of dlls which support it.

According to the official manual:
3.3 How do I get image support?
Emacs has built in support for XBM and PBM/PGM/PPM images. This is sufficient to see the monochrome splash screen and tool-bar icons. Since 22.2, the official precompiled binaries for Windows have bundled libXpm, which is required to display the color versions of those images.
Emacs is compiled to recognize JPEG, PNG, GIF and TIFF images also, but displaying these image types require external DLLs which are not bundled with Emacs. See Other useful ports.
Those dlls for the various image formats are (as far as I know) - XPM (xpm4.dll), PNG (libpng13.dll, zlib1.dll), JPEG (jpeg62.dll), TIFF (libtiff3.dll) and GIF (giflib4.dll);

Starting with Emacs 25 the Emacs Windows download directory includes -deps zip packages, that can be extracted to your emacs installation folder and include image libraries for PNG, SVG, JPEG, GIF, TIFF and more.
See also this emacs.stackexchange answer.

To display which version of the PNG dll your Emacs for Windows version requires, you can evaluate (cdr (assq 'png dynamic-library-alist))

Related

Downside from renaming WebP to JPG or other?

If I compress and save an image as WebP and then rename the extension as jpg will there be any downsides? This is why I ask:
My blog doesn't support WebP format, however if I rename it to png or jpg it will accept it.
What's the possible downsides on this trick?
As of December 2020, all major browsers support JPEG, but not all fully support WebP [https://caniuse.com/webp]. Users of browsers without WebP support won't see the images when visiting the page, so this might be why your blog platform doesn't accept WebP files.
Another downside: if someone downloads an image, the downloaded file will still have the ".jpg" extension despite being WebP format. Many programs depend on file extensions to know how to open it. They will try to decode it as JPEG, but fail, since the file is WebP.
I just change the name from .webp to .jpg and I have never had a problem. Obviously, you have to set your file manager (File Explorer) to be able to view the file name extensions.

Ghostscript PDF fonts becomes boxes in Adobe Illustrator where as its output is fine when opened in Adobe Acrobat

I need to convert the PDF of RGB color space to Grayscale using commandline tool supporting for Windows and Linux.
When i used Ghostscript the conversion is happening but when the output is opened in illustrator the fonts were shown as boxes.
Is there any solution option available in Ghostscript to overcome this font issue.
Is there any other commandline tool available for this conversion.
The font encoding is always built in is there any ways available to change it as ANSI encoding.Screenshot of font issue on illustrator VS the working scenario on acrobat
Pictures of the problem really don't help. You need to provide the following:
The version of Ghostscript you are using, and the platform (Linux, Windows etc), the word size of the version of Ghostscript and where you sourced this version of Ghostscript from (official Ghostscript download page, package, self-built binary).
An example file to reproduce the problem
The exact command line you used to reproduce the problem, and any supporting files required.
I suspect that your problem is that the original PDF file does not include the fonts that it uses, and that you have left SubsetFonts as true, and have left the AlwaysEmbed and NeverEmbed arrays untouched. This will mean that the new PDF file also does not include the fonts, which means that any PDF consumer must use a substitute font. The 'boxes' you refer to are /.notdef glyphs which are used when the font does not contain the glyph being requested.
Having the Encoding 'built-in' doesn't help with anything at all, it's the presence or absence of the fonts which matters. No, you can't change the encoding to 'ANSI', if you do that (assuming it isn't already WinAnsiEncoding) you'll see very similar problems to the ones you are complaining of here. You would also need to change the text character codes in the PDF file to be able to change the Encoding.
You could also raise this as a bug at https://bugs.ghostscript.com, where you will also have to supply an example file (as simple as possible) and all the other information listed above.

Converstion of PS to PDF Using Ghostscript Out PDF is not Embedded Thumbnails (DoThumbnails)

Am using Ghostscript 9.07 for converting the Postscript file to the PDF file. The output PDF file is not embedded the thumbnail view (which lies in the left hand side of the PDF file small view). In Adobe Acrobat distiller it has the option to embedded thumbnail in the Joboption file if the Joboption having the tick mark then the PDF is embedded with Thumbnail view. In Ghostscript DoThumbnails is the option to do the embedding thumbnail view. But its not appearing in the PDF file.
command
gs -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf input.ps
Kindly let me know how to solve this problem.
Note: This is possible in the Acrobat Professional using manually doing the right click in the thumbnail view and embed All Page Thumbnails option.
pdfwrite doesn't support creating thumbnails in the output PDF file.
Answer: Embedded the thumbnail view in Adobe Acrobat distiller will not work. Here is what you do. Go into your distiller settings tab and for your conversion settings select "PDF/A-1a:2005". Even if ImageMagic and GhostScript are 7 years old it should "convert" properly. The PDF/A-1b:2005 specification is actually known as ISO 19005-1B:2005. Adobe prefers to call the Adobe Distiller setting “PDF/A-1b:2005” and not use the “ISO 19005-1B:2005” description. The Portable Document Format (PDF) was originally an Adobe Systems proprietary format until it was released as "open source" on July 1, 2008 and published as ISO.
A free direct download PDF test file with detailed instructions to solve a "PDF Thumbnail Generation Problem" in TYPO3 CMS is available at Smargasy, Inc. "http://www.smargasy.com/fileadmin/media_data/community/Smargasy_PDF-Thumbnail-Compatibility-Test-File.pdf". The test file helps isolate the problem on systems that use ImageMagick and GhostScript as the image processing and conversion programs in a shared hosting environment.
Best Regards,
Michael Brice

Creating 32bpp BMP file for toolbar image strip?

I've got a 16 pixel high image that I've created in Paint.NET that I'd like to use in a Visual Studio toolbar.
My image is a .PDN file with multiple layers. Visual Studio requires a 32bpp BMP file. How do I convert the .PDN file to the correct format .BMP file?
I'm not looking to have this happen in my program.
I'm cool with having to do something manually whenever a change is made to the .PDN file, although I'd prefer something I can integrate with my automated build.
I've tried using the BmpX extension to Paint.NET, but it saves the background as white, rather than transparent. I've tried using ImageMagick's convert utility, but something's wrong with the saved BMP file, and VS displays it slightly corrupted and offset to the right by a couple of pixels.
Note: I'm using convert.exe by saving from Paint.NET as a .PNG file and then using convert strip.png strip.bmp. The transparency's correct, though.
It turns out that VS2010 can cope with .PNG files.

Miktex on Windows Vista

I have some problems with Miktex installed on Windows Vista Business SP1/32 bit. I use miktex 2.7, ghostscript, and texniccenter 1 beta 7.50. When I compile a document with the following profiles: Latex=>DVI, Latex=>PDF everything works fine; the system crashes when I compile with profiles Latex=>PS and Latex=>PS=>PDF. The error is reported into a window that states: "Dvi-to-Postscript converter has stopped working". What can I do? I need Latex=>PS=>PDF to include my images into the final PDF.
Thanks in advance,
Yet another LaTeX user
If everything you need is images, you could still compile directly to PDF. You only need to have an image in PNG or JPG format, and use the following code:
%in the document preamble
\usepackage{graphicx}
%in the document, in the place where you want to put your image
\includegraphics{image_filename_without_extension}
When the image is a PNG or JPG file (there are some more, I don't remember which ones ATM), you can compile the file with pdfLaTeX, but not with the normal LaTeX (i.e. you can produce a PDF, but not DVI or PS).
Of course normally, if everything works fine, it's nice to have one copy of the image in EPS, and another in, say, PNG -- this way you can compile easily both to PDF, and to PS.
Hope that helps.
Thanks for reply. I have solved the problem: the dvi crashed because I have installed Miktex with the User Account Control enabled. I have disabled it, reinstalled and now it's working (with UAC still disabled).

Resources