Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 17 Nov 2019, 05:12
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Graphics
Get-Image-Size
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
rcrsn51


Joined: 05 Sep 2006
Posts: 12769
Location: Stratford, Ontario

PostPosted: Wed 06 Feb 2019, 08:36    Post subject:  Get-Image-Size  

Here is a little tool named get-image-size that can extract the dimensions of a graphic file and assign them to variables. For example:

Code:
read WIDTH HEIGHT <<< $(get-image-size photo.jpg)
echo width=$WIDTH height=$HEIGHT

The attached tarball contains 32/64bit versions. Rename the one you need and copy it to /usr/local/bin.
get-image-size.tar.gz
Description 
gz

 Download 
Filename  get-image-size.tar.gz 
Filesize  3.86 KB 
Downloaded  141 Time(s) 
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14474
Location: Gatineau (Qc), Canada

PostPosted: Wed 06 Feb 2019, 09:49    Post subject:  

Thanks, rcrsn51.

One could alternatively use utilities from the netpbm suite:
Code:
jpegtopnm X.jpg > X.pnm
pamfile X.pnm
Source.

But yours saves a step.

BFN.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 12769
Location: Stratford, Ontario

PostPosted: Wed 06 Feb 2019, 10:23    Post subject:  

Quote:
and assign them to variables

What's the point in demonstrating code that doesn't accomplish the objective?

If I was willing to use more code that extracts the dimensions from pamfile, I wouldn't have bothered developing this tool.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14474
Location: Gatineau (Qc), Canada

PostPosted: Wed 06 Feb 2019, 13:40    Post subject:  

Of course.
_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1504
Location: Ukraine

PostPosted: Wed 06 Feb 2019, 15:27    Post subject:  

Dear rcrsn51,

Thanks very much. I once did something similar using the STB library, but your code is tiny. Can you please post your source, so that I can see how you do it? I see it handles xmp, png, gif, jpg, bmp and svg nicely. I would also like to compile it for my RPI3.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 12769
Location: Stratford, Ontario

PostPosted: Wed 06 Feb 2019, 15:47    Post subject:  

Attached. It is based on mu's work here.
get-image-size-source.tar.gz
Description 
gz

 Download 
Filename  get-image-size-source.tar.gz 
Filesize  594 Bytes 
Downloaded  137 Time(s) 
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1504
Location: Ukraine

PostPosted: Wed 06 Feb 2019, 16:50    Post subject:  

Dear rcrsn51,

Thanks for the source. It looks familiar. Smile I use those same fucntions from the gdk pixbuf loader in my picscale. In my STB-based getsize, there is no external dependency (gdk/gtk2), but the binary is significantly larger, so your little utility is probably better for most purposes and on most platforms. Smile

It works nicely on RPI3, too. I have attached an armv7 (jessie) binary for the RPI3.

Thanks again.

With kind regards,
vovchik
get-image-size-armv7-jessie-rp3.tar.gz
Description 
gz

 Download 
Filename  get-image-size-armv7-jessie-rp3.tar.gz 
Filesize  2.23 KB 
Downloaded  132 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Graphics
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0388s ][ Queries: 12 (0.0102s) ][ GZIP on ]