Deskew and auto combine

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ylafont
Posts: 28
Joined: 2014-11-03T16:33:39-07:00
Authentication code: 6789

Deskew and auto combine

Post by ylafont »

I have 2 novice questions on IM and hoping someone can provide some tutelage,

I am have been trying to deskew an image but recieve warnings. I was was wondering if i was doing something wrong

convert image1.tiff -deskew 40% image1_Deskewed reports

Code: Select all

convert.im6: "XPosition": Information lost writing value (-0.00333333) as (unsigned) RATIONAL. `/home/pi/PiScans/Scan-15395/bw_NoBo                                           rder_Deskewedout2.tif' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: "YPosition": Information lost writing value (-0.106667) as (unsigned) RATIONAL. `/home/pi/PiScans/Scan-15395/bw_NoBord                                           er_Deskewedout2.tif' @ warning/tiff.c/TIFFWarnings/768.
and
convert image1.tiff -set option:deskew:auto-crop image1_Deskewed reports the same

Code: Select all

convert.im6: "XPosition": Information lost writing value (-0.00333333) as (unsigned) RATIONAL. `/home/pi/PiScans/Scan-15395/bw_NoBorder_Deskewedout2.tif' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: "YPosition": Information lost writing value (-0.106667) as (unsigned) RATIONAL. `/home/pi/PiScans/Scan-15395/bw_NoBorder_Deskewedout2.tif' @ warning/tiff.c/TIFFWarnings/768
.


is there something else i need to try or can these warning be safely ignored?

additionally. the scripted that execute this command acutually runs a few command at the same time.

Code: Select all

		convert $tmpdir/$page -colorspace gray -level 10%,90%,1 -blur 2 +dither -monochrome $tmpdir/bw_$page
		convert $tmpdir/bw_$page -stroke black -fill black -draw "rectangle 0,0 50,3505" -draw "rectangle 0,0 2548,50" -draw "rectangle 0,3405 2548,3505" -draw "rectangle 2448,0 2548,3505" +matte $tmpdir/bw_Border_$page
		convert $tmpdir/bw_Border_$page -fill white -draw "color 0,0 floodfill" +matte $tmpdir/bw_NoBorder_$page
		#tifftopnm --quiet raw_page_bw_noborder.tiff | pamtilt -
		#convert $tmpdir/bw_NoBorder_$page -deskew 40% $tmpdir/bw_NoBorder_Deskewed$page
		convert $tmpdir/bw_NoBorder_$page -set option:deskew:auto-crop $tmpdir/bw_NoBorder_Deskewed$page
Is there a method of concatenating these command into one to shorten processing time?

thank you.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Deskew and auto combine

Post by snibgo »

I know nothing about "Information lost writing value".

Your commands are mostly of the form:

Code: Select all

convert file_1 {processing_1} file_2
convert file_2 {processing_2} file_3
convert file_3 {processing_3} file_4
If you don't need file_2 and file_3 you can do this:

Code: Select all

convert file_1 {processing_1} {processing_2} {processing_3} file_4
If you do need file_2 and file_3 you can:

Code: Select all

convert file_1 {processing_1} +write file_2 {processing_2} +write file_3 {processing_3} file_4
However, beware of one {processing} group that sets something (eg "-fill", "-compose") where another {processing} group assumes a default value for that setting.
snibgo's IM pages: im.snibgo.com
ylafont
Posts: 28
Joined: 2014-11-03T16:33:39-07:00
Authentication code: 6789

Re: Deskew and auto combine

Post by ylafont »

snibgo, you are correct on the format. I don not need the generated files with the exception of the last one.

Thank you for the guidance. Will try out as soon as i get a new machine up and running. thank you.
Post Reply