ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ive been trying to figure out a way to write some bash script that will record to a .txt file images over a certain amount of pixels. Ive been reading on ImageMagick but I was wanting to know if there is a better way to just code it out in bash?? I can write an if statement based on file size but I need it by dimensions. Can this be done and if so how??
What do you mean by "printing as variables"? identify outputs the results as text.
yes I wanted to write a loop and echo the results if the images are more than a total number of pixels. When I research about loops it shows me two different options with either integers or strings
What Im trying to do is figure out how to use imageMagick to write bash script to tell me what images are to large based on pixels. I know how to do this with size but that's why I asked the question how to tell what the dimension is and if you echo what is it echoing an integer or string.
My idea is pull the height and width if they can be echoed as integers and times the integers. Run an >= on the size i want to flag.
My idea is pull the height and width if they can be echoed as integers and times the integers. Run an >= on the size i want to flag.
bash does not differentiate between integers and strings. Every variable is treated as a string, unless in math context. You can't make any program to output values "as integers". stdout is a character stream.
what i do is resize the images regardless of size because it is easier than identifying those that are too big then going back and selectively resize certain files:
what i do is resize the images regardless of size because it is easier than identifying those that are too big then going back and selectively resize certain files:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.