USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

png to jpg

 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Command Line Commands
View previous topic :: View next topic  
Author Message
stonecarver
Advanced Member


Joined: 18 Dec 2024
Posts: 833
Location: SE Alaska

PostPosted: Tue Sep 11, 2024 8:02 pm    Post subject: png to jpg Reply with quote

If you've changed format with Gimp you'll love this
Code:

convert file.png file.jpg



_________________
linux mint 3.0 Kde
sidux - erebos
Back to top
View user's profile Send private message
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Tue Sep 11, 2024 9:09 pm    Post subject: Reply with quote

convert is part of Imagemagick ........... which is what my bbips stuff uses Smile
convert can do waaaayyyyy more than just switch the formats Very Happy Very Happy

Take a look at the bbips stuff ....... http://crouse.us/scripts/bash/bbips/

For example....... here is the bbips script to add borders to all your images....
Code:

#!/bin/bash
# FILE : bbborder.sh
# Function: Puts a border on all images in the directory.
# Copyright (C) 2024 Dave Crouse <dave NOSPAMat usalug.org>
# ------------------------------------------------------------------------ #
if [[ -z $( type -p convert ) ]]; then echo -e "ImageMagick -- NOT INSTALLED !";exit ;fi

if [[ -z "$1" || -z "$2" ]]; then
   echo " ";
   echo "      ######### COMMAND FAILED ########## ";
   echo "      USAGE: $0 bordercolor bordersize";
   echo "      EXAMPLE: $0 black 6";
   echo "      ######### COMMAND FAILED ########## ";echo " ";
   exit
else

export IFS=$'\n';
for i in $(find . -maxdepth 1 -type f -iname "*.jpg");
do
convert -bordercolor $1 -border $2x$2 ${i:2} _${i:2}
mv _${i:2} ${i:2}
echo "Created border on ${i:2}" ;
done
fi
exit 0


The line that does the work........
convert -bordercolor $1 -border $2x$2 ${i:2} _${i:2}
or used on a single image could look like.......

convert -bordercolor red 5x5 myimage.jpg newimagewithborder.jpg

convert and imagemagick are pretty darn slick Wink



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
lberg
Sr. Member


Joined: 28 Jul 2024
Posts: 1289

PostPosted: Wed Sep 12, 2024 12:34 am    Post subject: Reply with quote

Wow! Thanks stonecarver! That could come in REALLY handy if it works on my Mac. I've had to convert with AppleWorks SOO many times....it's annoying.



_________________
2 Computers: Arch Linux, 64-bit
3 Computers: Arch Linux, 32-bit
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Command Line Commands All times are GMT
Page 1 of 1

 
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
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse