Error on convert pdf to png using ImageMagick - imagemagick

Give error while convert pdf to png by using below command :
convert -density 300 -depth 8 -quality 85 655382767_1460008284.pdf[0-9] 655382767_1460008284.png
OS : Redhat 64 bit 6.7
ImageMagick : version 6.7.2-7 2015-02-27 Q16
Ghostscript : GPL Ghostscript 8.70 (2009-07-31)
Its give below error :
+++++++++++++++++++++++++++++++++
Error: /ioerror in --showpage--
Operand stack:
1 true
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1862 1 3 %oparray_pop 1861 1 3 %oparray_pop 1845 1 3 %oparray_pop --nostringval-- --nostringval-- 4 1 8 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- 1745 0 9 %oparray_pop --nostringval-- --nostringval--
Dictionary stack:
--dict:1157/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:106/127(ro)(G)-- --dict:286/300(ro)(G)-- --dict:22/25(L)-- --dict:4/6(L)-- --dict:27/40(L)--
Current allocation mode is local
Last OS error: 28
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
convert: Postscript delegate failed 655382767_1460008284.pdf': No such file or directory # error/pdf.c/ReadPDFImage/664. convert: missing an image filename655382767_1460008284.png' # error/convert.c/ConvertImageCommand/3015.
++++++++++++++++++++++++++++++++++
Please help me to fix it.
Also some other pdf files are converted perfactly to png.
Please find attachment of pdf file which are making issue on converting to png using Imagemagick convert command.
enter link description here

ioerror means there was an I/O error, which may mean that the disk is full, or there was some other problem. Try using a lower resolution ('density' in IM terms I think). Given that you have 8 pages, each page is 32x76 inches and you have a resolution of 300 dpi you are looking at producing a lot of data, about 1.8Gb if depth=8 means greyscale.
There could be any number of other reasons why there was an ioerror, the next thing to do is to try a more recent version of Ghostscript 8.70 is now 6 years old..... As Mark Setchell suggests you could also try using a more recent version of ImageMagick, though I doubt that will help, since its clearly an error being returned from Ghostscript.

Related

ImageMagick `-duplicate` but to beginning of sequence

-duplicate
convert img*.png -duplicate 3 out.gif
makes
0 1 2 2 2 2
where 0 is img0.png, and 1 is img1.png, etc, making a GIF. But can I make below?
0 0 0 0 1 2 2 2 2
that is, append to end and start? I get I can use indexing to make
0 1 2 2 2 2 0 0 0
which is identical in a loop, but I need the 0s at start in context.
TL;DR for 0 0 0 1 2 3 ... 20 21 21 21 (any number of images) do
convert img*.png -write mpr:imgs -delete 0--1 mpr:imgs[0,0,0,1--1,-1,-1] out.gif
Using ImageMagick v6 on Windows command line, this command will let you arrange the order and number of images in any way you need.
convert img*.png -write mpr:imgs -delete 0--1 mpr:imgs[0,1,2,2,2,2,0,0,0] out.gif
That reads the 3 input images, copies them all into a memory register named "mpr:imgs", deletes the input images from the command, then reads the images from that memory register as you specify in the square brackets. The image index 0 is the first image read into the command, 1 is the second, etc.
Also, using -duplicate you can specify which image in the list you want to use according to their order in the list. This command will give the same result as the one above...
convert img*.png -duplicate 3 -duplicate 3,0 out.gif
The command reads the three images, then -duplicate 3 makes 3 more of the last image in the list, then -duplicate 3,0 makes 3 more of the first image in the list, index 0.
Another approach would be to use ( -clone ... ) inside parentheses to create the number of duplicates in the order you want.
convert img*.png ( -clone 2,2,2 -clone 0,0,0 ) out.gif
That reads the 3 input images, clones the third image 3 times, then clones the first image 3 times, giving the same result as the commands above.
These commands are in Windows syntax. For a *nix OS you'd have to escape the parentheses with backslashes "\(...\)".
Also helpful are -swap, -reverse, -insert, and -delete to manipulate the order of images in the list.
You should be able to load your first image, make any duplicates you need, then load the second and make duplicates and load the third and make any duplicates:
convert img0.png -duplicate 3 img1.png img2.png -duplicate 3 ...
will give your desired image sequence:
0 0 0 0 1 2 2 2 2

How to place printer driver parameters in postscript print file?

i have a postscript file, which has heavily printer driver setting dependencies. I am trying to bundle printer settings into my postscript printfile and passthrough it to the printer. The passthrough works just fine with `lpr -l . But i am not able to bring some options from the ppd directly into the postscript file.
Xerox pdd file snipped
*OpenUI *OutputMode/Print Quality: PickOne
*OrderDependency: 46.0 AnySetup *OutputMode
*DefaultOutputMode: HighSpeed
*OutputMode HighSpeed/High Speed: "
<</PostRenderingEnhance true
/PostRenderingEnhanceDetails currentpagedevice
1 index get 1 dict copy
dup /Type 33 put
dup /OutputMode (high-speed) put
>> setpagedevice
"
*End
*OutputMode HighQuality/High Quality: "
<</PostRenderingEnhance true
/PostRenderingEnhanceDetails currentpagedevice
1 index get 1 dict copy
dup /Type 33 put
dup /OutputMode (highest-quality) put
>> setpagedevice
"
*End
*OutputMode HighResolution/High Resolution: "
<</PostRenderingEnhance true
/PostRenderingEnhanceDetails currentpagedevice
1 index get 1 dict copy
dup /Type 33 put
dup /OutputMode (highest-resolution) put
>> setpagedevice
"
*End
*CloseUI: *OutputMode
When i place the highest-resolution part at the beginning of the %%BeginPrelog part, than i get an invalid file:
<</PostRenderingEnhance true
/PostRenderingEnhanceDetails currentpagedevice
1 index get 1 dict copy
dup /Type 33 put
dup /OutputMode (highest-resolution) put
>> setpagedevice
When i evaluate the correctness of the file via ps2pdf i get the following error:
Error: /undefined in --get--
Operand stack:
--nostringval-- PostRenderingEnhance true PostRenderingEnhanceDetails --dict:210/309(ro)(L)-- PostRenderingEnhanceDetails
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1990 1 3 %oparray_pop 1989 1 3 %oparray_pop 1977 1 3 %oparray_pop 1833 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:731/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)--
Current allocation mode is local
Current file position is 308
GPL Ghostscript 9.50: Unrecoverable error, exit code 1
Nevertheless, the setpagedevice options from this post works just fine:
How to select PostScript printer output tray
So i do not know how to convert the ppd option to valid postscript code. Does anyone have a clue here, how to get a valid postscript file?
You are trying to apply a device-specific control (/OutputMode) to a device which does not support that control. Not only that, but the code you include acesses the current page device dictionary and assumes that there will be a PostRenderingEnhanceDetails dictionary in it. The code makes no attempt to check if the required data exists which means it will only work on a device which has a /PostRenderingEnhanceDetails entry in the page device dictionary. The pdfwrite device (which is what ps2pdf uses) does not have such an entry, which is why you get an error.
There may be nothing wrong with your PostScript, its simply that you can't apply it to that device. Note that all the keys in the question you link to are standard page device dictionary entries, OutputMode is not and there is no PostRenderingEnhanceDetails entry either.
The PostScript code in the PPD (PostScript Printer Description) is all that you need to use, but the opint of a PPD is to include PostScript that will only work reliably on the printer its intended for. You can't use Ghostscript to test the correctness of device-specific PostScript configured for a non-Ghostscript device.

OpenCV's createsamples tool fails to use all samples when converting info file to vec file

I've created an info text file by using opencv_annotation tool, with around 300 image, and some contain multiple ROIs (Region of Interests). The following is an example output of the file, with dots indicating many lines with the same format:
positives\1\105.png 1 9 10 17 14
...
positives\2\003.png 2 14 2 5 7 11 18 8 9
...
positives\3\045.png 3 21 9 7 9 13 10 9 11 7 15 6 7
However, opencv_annotation then crashes, with the error assertion failed (ssize.area() > 0) ..., and only a fraction (~200 out of ~600) of the ROIs in the info text file were placed into the vec file, verified by how opencv_traincascade reports insufficient samples when using the parameter -numPos 500 when attempting to use the vec file.
Why does this occur, and how can I fix it?
The cause of this is that a ROI that was improperly defined while creating the samples.
In my specific case, this specific line was found:
positives\2\005.png 2 9 6 6 7 0 0 0 0
Recall how the format of these files:
[filename] [# of objects] [[x y width height] [... 2nd object] ...]
In my case, the specified region had a width and length of 0 pixels, which causes opencv_createsamples to crash with the very error. Simply removing the object data and decrementing the [# of objects] by one solved this issue, like so:
positives\2\005.png 1 9 6 6 7
Additionally, one should also look out for values that reach out of bounds, such as the following:
positives\2\005.png 2 9 6 6 7 -5 0 3 2
positives\2\005.png 2 9 6 6 7 30 30 200 300
positives\2\005.png 2 9 6 6 7 35 35 3 5
In the first example, no point should be negative. In the second example, our .png file is only 32 x 32 pixels large, so a ROI cannot have a width and height of 200 and 300, respectively. Finally, in the last example, the x and y positions are out of bounds of our image.

Haar-cascade training took very little time and no xml was produced

I'm trying to train a new haar-cascade for faces.
I have a positive dataset of 2000 cropped face images (just the face) and 3321 negative random images.
I created positive's list using the following command:
opencv_createsamples.exe -info info.txt -vec vector.vec -num 2000 -w 10 -h 10
Where the file info.txt contains the following lines:
AJ_Cook_0001.ppm 1 0 0 64 64
AJ_Lamas_0001.ppm 1 0 0 64 64
Aaron_Eckhart_0001.ppm 1 0 0 64 64
Aaron_Guiel_0001.ppm 1 0 0 64 64
Aaron_Patterson_0001.ppm 1 0 0 64 64
Aaron_Peirsol_0001.ppm 1 0 0 64 64
Afterwords, I ran haar_training using the following command:
opencv_haartraining.exe -data harrcascade -vec vector.vec -bg infofile.txt -nstages 20 -minhitrate 0.9999 -maxfalsealarm 0.5 -npos 2000 -nneg 3321 -w 10 -h 10 -nonsym -mem 1024
Where the file infofile.txt contains the names of the background images:
Bing_000527adc064a067a7f7986f00b140fe.jpg
Bing_002744f85b0bee37f489f43fad5f613f.jpg
Bing_0048e7e5e487203dedba9feb03696b1e.jpg
Bing_00513e8879f4f544717df2c8ea0494b1.jpg
Bing_00543a6cf117f559a05f0fb7e10bd361.jpg
Training took about only an two hours and no xml file was generated. The folder harrcascade contains 20 folder with a txt file named 'AdaBoostCARTHaarClassifier.txt' but no xml was generated.
I have two questions:
Why did training took so very little time?
Why no xml file was generated?
What am I missing here?
Thanks,
Gil.
See my answer to your other question. If no xml file was produced, it is very likely that you have run out of positive samples. Try using 1500 instead of 2000.
Better yet, check out trainCascadeObjectDetector, a function in the Computer Vision System Toolbox for Matlab, which lets you generate an xml file compatible with OpenCV.

XNA curve import from Maya?

I am trying to import a movement curve from Maya into my XNA game, but I cannot figure out how. Basically I want to catch the curve by it's name, and look up its values at different points of time.
Are curves exported into FBX at all? And, if not, then how to catch it?
Edit: Maya can export to Maya ASCII, and I tried to parse it, but I am not sure what formula I should use to recreate the curve.
Here is a Maya ASCII segment defining a typical curve:
createNode transform -name "curve1";
createNode nurbsCurve -name "curveShape1" -parent "curve1";
setAttr -keyable off ".visibility";
setAttr ".cached" -type "nurbsCurve"
3 11 0 no 3
16 0 0 0 1 2 3 4 5 6 7 8 9 10 11 11 11
14
-4.9774564508407968 0 -6.8331005825440476
-5.5957526204336077 0 -5.5944567905896161
-6.8323449596191823 0 -3.1171692066807277
-5.6935230034445992 0 3.3047128765440847
-1.6528787527978079 0 8.8676235621397499
7.5595909161095838 0 10.325347443191644
9.2297347448508607 0 8.5586791722955731
10.0730315036276 0 0.93412333819133941
5.9770106513247976 0 3.7809964481624871
2.9006817236214149 0 -3.3327711853359037
11.373191256465434 0 -4.6672854260704906
4.5697574985247682 0 -14.178349348937205
2.4191279569332935 0 -11.415532638650156
1.3438131861375628 0 -10.034124283506653
;
I managed to find the file format reference somewhere, the important info here is the knot indexes (16 0 0 0 1 2 3 4 5 6 7 8 9 10 11 11 11) and the coordinates (all lines containing three numbers).
But, I still have no idea how to recreate the curve. I googled a lot for nurbscurves, bsplines etc, but could not successfully match the result in Maya with any code I could find.
I've achieved this in 3dsmax by exporting the curve in Ascii format and parsing the text manually, does Maya have any such exporter?

Resources