Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Reading Colorspace of PDF, AI, EPS before converting to JPG

$
0
0
We have an application that we want to start to allow people to upload PDF, AI, and EPS files. So far so god but I can't figure out how to get the info such as colorspace of the file. We want to get this before processing and creating thumbnails so that we can provide appropriate alerts to the user, based on the colorspace of the file.

This is what we are using which has worked fine rasterized images but not postscript or vector based files. We have tried converting the file to a JPG first to but that ends up also converting it to an RGB file.

public string GetImageInfo(string vFilePath)
{

    // Read from file
    MagickImageInfo info = new MagickImageInfo();

  // Read from stream
    using (MemoryStream memStream = LoadMemoryStreamImage(vFilePath))
    {
        info = new MagickImageInfo(memStream);
    }

    // Read from byte array
    byte[] data = LoadImageBytes(vFilePath);
    info = new MagickImageInfo(data);

    info = new MagickImageInfo();
    info.Read(vFilePath);

    using (MemoryStream memStream = LoadMemoryStreamImage(vFilePath))
    {
        info.Read(memStream);
    }
    info.Read(data);

    string ReturnInfo = "&Width=" + info.Width;
    ReturnInfo += "&Height=" + info.Height;
    ReturnInfo += "&ColorSpace=" + info.ColorSpace;
    ReturnInfo += "&Format=" + info.Format;
    ReturnInfo += "&ResolutionX=" + info.ResolutionX;
    ReturnInfo += "&ResolutionY=" + info.ResolutionY;


    return ReturnInfo;
}

The error it generates indicates
" w3wp.exe: UnableToCreateTemporaryFile ': No such file or directory @ error/pdf.c/ReadPDFImage/462"

I will appreciate any insight.

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>