Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Detect boundaries within .png's - and cropping

by Tux (Canon)
on Jul 08, 2020 at 09:25 UTC ( [id://11119031]=note: print w/replies, xml ) Need Help??


in reply to Detect boundaries within .png's - and cropping

The other two answers are good (and way better than my approach), but I'd share my thoughts anyway.

As .xpm data is extremely easy to analyse, I'd do

$ convert -transparent-color Black file.png file.xpm

Where Black should be replaced with a color not in the image. Then analyze the .xpm and use that to crop the image.

To be completely dynamic, you can repeat the process for Black, White, and Red and take the minimum margins of the three analises.


Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119031]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-16 20:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found