[magick-users] import | convert

Carl Karsten carl at personnelware.com
Sun Jul 9 20:46:20 PDT 2006


Anthony Thyssen wrote:
> Carl Karsten on  wrote...
> | There is something wrong with piping output from import into identify or convert.
> | 
> | In the following, I am dragging the box around the word "Loading" - each time 
> | the box isn't exactly the same, but it is close enough - not enough to cause the 
> | behavior I am seeing.
> | 
> | carl at amd15:~/gocr$ import - | identify -
> | /tmp/magick-XXSFiexS PS 2624x1968 2624x1968+0+0 DirectClass 14.8mb 0.290u 0:02
> | 
> | carl at amd15:~/gocr$ import test.miff | identify test.miff
> | test.miff MIFF 71x29 2624x1968+854+1105 DirectClass 12kb
> | 
> The image is 71x29  but is located on a very large 'vritual canvas' or
> 'page'.  this identifies the location of the display from which the
> image (not text) was selected.
> 
> Also in the above the pipe line was NOT used. You just saved the image
> into a file and had identify read the result from that file
> You may as well have used two seperate commands...
>    import test.miff
>    identify test.miff
> 
> To  remove, reset the virtual page using +repage
> 
>    import tiff:- | convert - +repage tiff:- | identify -

Ok, that solved my problem - thanks.

But I am still a bit confused.  I understand the pipe in my 2nd line wan't 
really piping anything, maybe I should have used ;

import test.miff ; convert test.miff pgm:- | ....

What I don't understand is how sending the output to a file and reading the file 
is different than piping.

> 
> | The problem came up trying to pipe into convert:
> | carl at amd15:~/gocr$ import - | convert - pgm:- |gocr -
> | 
> Att the +repage to remove any virual canvas in the convert.
> 
> | Eventually I want to get the resulting text such that I can paste it into an 
> | email message.  xclip is close, but that "selects" the text, and Thunderbird 
> | doesn't seem to use the "selected" text when you hit Paste or Shift+Ins.
> | 
> Of course it doesn't.  You are selecting an image, not making a X
> windows text selection, which is completely different things.

I think you mised the gocr step - with the options you posted, this now works:

import tiff:- | convert - +repage pgm:- | gocr - | xclip -selection clipboard

and now that I see that import can create other formats, I can get rid of the 
convert:

import pgm:- | gocr - | xclip -selection clipboard

Thanks again.

C


More information about the Magick-users mailing list