Woohoo!!! That did the trick. Now the pdf is 414KB instead of 1.38MB. Magick.NET has now caught up and surpassed my command line method. Thanks for all your help.
↧
New Post: Minimize file size of embedded images in PDF output
↧
New Post: Feeding in Jpeg stream from pdf gives error
Hi,
I have a bunch of pdf files that are composed solely of scanned document jpegs. I am trying to shrink the file by pulling out each jpeg and processing it with Magick.NET. I am using PDFSharp to extract all the jpegs from each pdf into a stream object and then feeding the stream to Magick.Net.
The problem is that when I do it this way, IM does not recognize the file as a jpeg and wants to invoke a BLOB delegate and throws an exception.
I am sure that the stream contains a jpeg because I can save the string to a file and open it as an image. I can even re-read that file back into IM without issue. I have even tried to detect the mime type of the stream before feeding it into IM with urlmon.dll and it confirms that the data is an "image/pjpeg". I just can't instantiate a MagickImage from the stream!
What am I doing wrong here?
I have a bunch of pdf files that are composed solely of scanned document jpegs. I am trying to shrink the file by pulling out each jpeg and processing it with Magick.NET. I am using PDFSharp to extract all the jpegs from each pdf into a stream object and then feeding the stream to Magick.Net.
The problem is that when I do it this way, IM does not recognize the file as a jpeg and wants to invoke a BLOB delegate and throws an exception.
I am sure that the stream contains a jpeg because I can save the string to a file and open it as an image. I can even re-read that file back into IM without issue. I have even tried to detect the mime type of the stream before feeding it into IM with urlmon.dll and it confirms that the data is an "image/pjpeg". I just can't instantiate a MagickImage from the stream!
What am I doing wrong here?
↧
↧
New Post: Feeding in Jpeg stream from pdf gives error
I am not sure why IM is not detecting your stream as a jpeg. You can help IM by specifying the format before you load your image. You can do that with the MagickReadSettings class:
MagickReadSettings settings= new MagickReadSettings(); settings.Format = MagickFormat.Pjpeg; using (MagickImage image = new MagickImage(stream, settings)) { }
↧
New Post: Running ghostcript from a non-standard install location
Thanks for the info about HKEY_CURRENT_USER. That fixes the administrative requirements, unfortunately it doesn't seem to work.
When I placed GS_DLL and GS_LIB in the same relative location in HKCU as HKLM I still get the "Magick: Postscript delegate failed" message.
When I placed GS_DLL and GS_LIB in the same relative location in HKCU as HKLM I still get the "Magick: Postscript delegate failed" message.
↧
New Post: Running ghostcript from a non-standard install location
Have you tried to enable logging in MagickNET and set Debug to true in your MagickImage to receive more information?
↧
↧
New Post: Running ghostcript from a non-standard install location
I'm not sure how to enable logging in Magick.NET or how to set Debug to true in MagickImage. Can you point me to some documentation?
Just for additional clarity:
I am able to run without any problems when the GS_DLL and GS_LIB options are placed in HKLM and when I remove them from the HKLM and put them here:
Just for additional clarity:
I am able to run without any problems when the GS_DLL and GS_LIB options are placed in HKLM and when I remove them from the HKLM and put them here:
[HKEY_CURRENT_USER\SOFTWARE\GPL Ghostscript]
[HKEY_CURRENT_USER\SOFTWARE\GPL Ghostscript\9.05]
"GS_DLL"="C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\bin\\gsdll64.dll"
"GS_LIB"="C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\bin;C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\lib;C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\fonts"
Then it fails and behaves the same whether I have them in HKEY_CURRENT_USER or not.↧
New Post: Running ghostcript from a non-standard install location
This is a bug in ImageMagick and I will have to fix this for you. It only works if it can also the find the 'HKLM' version.
You can enable logging like this:
The output will be written to the console and the debug window of visual studio. I am working on adding a Log event to the MagickNET class. I will also add a page about this to the documentation then.
You can enable logging like this:
MagickNET.SetLogEvents(LogEvents.All); // LogEvents.All will show you the most information. MagickImage image=LoadImage(); image.Debug = true; PerformActions(image);
↧
New Post: Running ghostcript from a non-standard install location
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
↧
New Post: green-screen background remove
Hi !
I am working on a photo software for desktop PC that works on Windows 8. I would like to be able to remove the green background from the photo.
I'm a beginner in image manipulation, i found some cool links ( like http://www.quasimondo.com/archives/000615.php ), but I can't transale it in c# code.
I'm using a webcam (with aforge.net) to see a preview and take a picture. I tried color filters but the green background isn't really uniform, so this doesn't work.
How to do that properly in C#?
Thanks !
I am working on a photo software for desktop PC that works on Windows 8. I would like to be able to remove the green background from the photo.
I'm a beginner in image manipulation, i found some cool links ( like http://www.quasimondo.com/archives/000615.php ), but I can't transale it in c# code.
I'm using a webcam (with aforge.net) to see a preview and take a picture. I tried color filters but the green background isn't really uniform, so this doesn't work.
How to do that properly in C#?
Thanks !
↧
↧
New Post: green-screen background remove
I have no experience with removing a green screen but you could try what is being suggested here: http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=14394. Or try the tricks from here: http://www.imagemagick.org/Usage/masking/#bg_remove. If you need more help please post an example image I can use.
↧
New Post: DPX Image Format to TIFF not work?
when i convert a DPX Image to a TIF image, a file will created but is corrupt.... other source files working....
Using image As New MagickImage("test.dpx")
image.Write("test.tif")
End Using
↧
New Post: DPX Image Format to TIFF not work?
Can you add a link to your test.dpx image? Feel free to contact me through CodePlex if you don't want to post a link here.
↧
New Post: DPX Image Format to TIFF not work?
no problem
http://titan.uplink.de/rept1000.dpx
btw: reading resolution and other image properties works
http://titan.uplink.de/rept1000.dpx
btw: reading resolution and other image properties works
↧
↧
New Post: DPX Image Format to TIFF not work?
The problem seems to be the bit depth. The resulting tif image has a bit depth of 10. When I change this to 12 I can open the image in Windows Photo Viewer. I will have to check if this is a bug in ImageMagick or lack of support for 10-bit tif files in Windows.
↧
New Post: DPX Image Format to TIFF not work?
ohh i see, when i add the 12bit convert option the the tif file is ok....
but with the 12bit convert something other happend :)
beside the 12bit convert i make a colorspace change to DCI XYZ space with this matrix
but with the 12bit converting i have false colors....
but with the 12bit convert something other happend :)
beside the 12bit convert i make a colorspace change to DCI XYZ space with this matrix
Dim matrix As New ColorMatrix(4)
matrix(0, 0) = 0.4124564
matrix(1, 0) = 0.3575761
matrix(2, 0) = 0.1804375
matrix(0, 1) = 0.2126729
matrix(1, 1) = 0.7151522
matrix(2, 1) = 0.072175
matrix(0, 2) = 0.0193339
matrix(1, 2) = 0.119192
matrix(2, 2) = 0.9503041
Using image As New MagickImage("test.dpx")
image.AddProfile(ColorProfile.SRGB)
image.Gamma(0.454545)
image.ColorMatrix(matrix)
image.Gamma(2.6)
image.BitDepth(Channels.Composite, 12)
image.Write("c:\test.tif")
End Using
without converting to 12bit (with a other source file bmp/tif 8bit) the colors are correct for the XYZ spacebut with the 12bit converting i have false colors....
↧
New Post: DPX Image Format to TIFF not work?
I have no experience with the DCI XYZ color space. Does the 'normal' color space conversion not work for you:
using(image = new MagickImage("test.dpx")) { image.ColorSpace=ColorSpace.XYZ; image.BitDepth(Channels.Composite, 12); image.Write("c:\test.tif"); }
↧
New Post: DPX Image Format to TIFF not work?
I have tried the build-in XYZ colorspace but this is not the right colorspace i need
before i used the magick.net, i have done the work with the Imagemagick OLE objekt and this code
before i used the magick.net, i have done the work with the Imagemagick OLE objekt and this code
img.Convert("-depth", "12", "-gamma", "0.454545", "-recolor", "0.4124564 0.3575761 0.1804375 0.2126729 0.7151522 0.0721750 0.0193339 0.1191920 0.9503041", "-gamma", "2.6", "-type", "TrueColor", input, output)
and works correct↧
↧
New Post: DPX Image Format to TIFF not work?
I think I figured out why the result from the command line is different then from Magick.NET. Magick.NET uses HDRI (http://www.imagemagick.org/script/high-dynamic-range.php) and it looks like there might be a bug in setting the channel depth in ImageMagick when HDRI is enabled. I will let get back to you when I know a bit more. Setting the bit depth to 16 bits did solve the problem for me.
p.s. The order of your matrix should be 3 instead of 4.
p.s. The order of your matrix should be 3 instead of 4.
↧
New Post: DPX Image Format to TIFF not work?
right with 16bit it works correct, but the image is bigger and i think this takes longer.
Can the HDRI mode disabled?
Can the HDRI mode disabled?
↧
New Post: DPX Image Format to TIFF not work?
HDRI cannot be disabled because it is a compiler option. I switched to HDRI because that will be enabled by default in ImageMagick 7.
As a work around you could choose to save your image as a png first and then convert this to a 12 bit tif. This seems to work (and save disk space) but is much slower.
As a work around you could choose to save your image as a png first and then convert this to a 12 bit tif. This seems to work (and save disk space) but is much slower.
↧