Re: ImageMagick: possibly OT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 17 Sep 2015, Bill Oliver wrote:

On Thu, 17 Sep 2015, Timothy Murphy wrote:

 I want to crop a PNG picture.
 I see how to do it with ImageMagick,
 once I know the pixel-positions of the corners of the rectangle.

 I'm wondering if there is a way of imposing a grid to read these numbers,
 either with ImageMagick or some other application that runs under Fedora ?



I may not be understanding the problem, but if you just need the four
corners, e.g. 0,0; 0,1023; 1023,0, 1023,1023 for a 1024 x 1024 image, and you don't want to need to look at the image, try the netpbm library,
e.g.

$ pngtopnm < tst.png | pnmfile


billo



As an aside, you can then crop it by using pnmcut.

So, for instance, if I wanted to cut a 100 pixel border from an image, I
might write a script that did this:


#! bin/sh

pngtopnm < $1 > tmp.pnm
pnmfile < tmp.pnm > jnk.txt
x=`awk '{print $4}' < jnk.txt`
y=`awk '{print $6}'< jnk.txt`
width=$(( x-100 ))
height=$(( y-100))
pnmcut  50 50 $width $height tmp.pnm > tmp2.pnm
pnmtopng tmp2.pnm > tmp.png
rm tmp.pnm
rm tmp2.pnm
rm jnk.txt

I know that awk is probably not the best thing for this, but I know awk, so...



billo
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux