question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No pixels defined in cache for some PDF's

See original GitHub issue

Description

When using the Ping command on a specific PDF asset, the following exception is raised:

Exception Message: no pixels defined in cache `C:/Users/KDECON~1/AppData/Local/Temp/magick-igIAnLjjffRbTW8Wg69TDYJeHOBYM2i41’ @ error/cache.c/OpenPixelCache/3682

Stacktrace: at ImageMagick.NativeInstance.CheckException(IntPtr exception, IntPtr result) in /_/src/Magick.NET/Native/NativeInstance.cs:line 57 at ImageMagick.MagickImage.NativeMagickImage.ReadFile(IMagickSettings`1 settings) in /_/src/Magick.NET/Native/MagickImage.cs:line 5309 at ImageMagick.MagickImage.Read(String fileName, IMagickReadSettings`1 readSettings, Boolean ping) in /_/src/Magick.NET/MagickImage.cs:line 7258 at ImageMagick.MagickImage.Ping(String fileName, IMagickReadSettings`1 readSettings) in /_/src/Magick.NET/MagickImage.cs:line 4717 at ImageMagick.MagickImage.Ping(String fileName) in //src/Magick.NET/MagickImage.cs:line 4708 at Program.<<Initialize>>d__0.MoveNext() in :line 8

Steps to Reproduce

Upload the following asset file: asset.pdf Ensure that GhostScript is installed on your machine. I’m using GhostScript 9.04 (but it can be reproduced on machine running GhostScript 9.54 as well) - Other versions have not been tested. Use the following RoslynPad script to reproduce the error. _NOTE: Change the path of the actual PDF to the correct location.

#r "nuget:Magick.NET-Q16-AnyCPU/8.5.0"

var image = @"C:\Temp\asset.pdf";
var imageMagickImage = new ImageMagick.MagickImage();

try
{
    imageMagickImage.Ping(image);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
    Console.WriteLine(ex.StackTrace);
}

System Configuration

  • Magick.NET version: 8.5.0 - But can be reproduced with version 7.23.2.1 - Other versions have not been tested.
  • Environment (Operating system, version and so on): Microsoft Windows 10 Professional - Version 10.0.19043 Build 19043.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemstracommented, Dec 22, 2021

Good point. I think my patch broke that now. Will need to check if I can still add that though.

0reactions
dlemstracommented, Jan 3, 2022

You will not be able to get the information because we don’t return an image and it’s information when an error occurs.

Are you testing this with the same asset.pdf file? The version that you are using (6.7.4) is an ancient version of ImageMagick that should not be used anymore. I don’t understand why you don’t get an error with that old version. Maybe you are also using a different version of Ghostscript there?

Read more comments on GitHub >

github_iconTop Results From Across the Web

no pixels defined in cache
I built a Linux binary from the IM 6.7.7-0 source tree. I observed the result from configure that jpeg was included.
Read more >
ImageMagick C# Exception : no pixels defined in cache
I'm trying to create a new image with a specific ColorType (it does the same thing with ColorSpace ) and I have this...
Read more >
MagickCacheErrorException Image Magick no pixels ...
MagickCacheErrorException : 'no pixels defined in cache `' @ error/cache.c/OpenPixelCache/3671'. Affected code:.
Read more >
Viewing PDFs and viewing preferences, Adobe Acrobat
Follow these steps to view PDFs in Read or Full Screen mode, set the Full Screen nav bar preference, read a document in...
Read more >
How to flatten PDF documents - Tutorial
Tutorial showing how to flatten redacted PDF files using Ghostscript and optionally ImageMagick and pdf2ps/ps2pdf utilities.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found