LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-14-2009, 05:13 PM   #1
Dralnu
Member
 
Registered: Jul 2005
Posts: 335

Rep: Reputation: Disabled
Opening and saving an image file in a bash script


I've recently moved many image files from an old external drive to a new install, but ls and hsetroot are ignoring these files as actual images (ls doesn't color them properly, and hsetroot says they are bad files). I'd like to try and resave these files instead of having to go through and redownload them. Is there any way to do this using bash?
 
Old 06-14-2009, 05:45 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
What does 'ls -l ' say about their size, what does 'file' say
about their content/type?


Cheers,
Tink
 
Old 06-14-2009, 10:35 PM   #3
Dralnu
Member
 
Registered: Jul 2005
Posts: 335

Original Poster
Rep: Reputation: Disabled
ls -sh (easier for me to read) gives 496k for size, and file gives idential output to a known good jpg, minus a comment.

I'm going to make a checksum of the file and compare it to the last known-good version.
 
Old 06-15-2009, 12:16 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
AFAIK, lscolors bases the color used on the filename extension of the file. Unless your ls uses another method to display colors, you should be able to fix the colors use by modifying $LSCOLORS (and you can modify the script that sets $LSCOLORS, to make it permanent).
I don't know about what hsetroot is/does. When you moved/copied the files from the external drive, do you know what kind of filesystem they were on? My speculation is that they were on a DOS or DOS-like filesystem, which used only upper case filenames. On my installation, lscolors only knows about the lower-case filename extensions. If your file names are all uppercase, perhaps it would be appropriate to rename them to more Unix conventional names, especially the extension part.

--- rod.
 
Old 06-15-2009, 03:27 PM   #5
jan61
Member
 
Registered: Jun 2008
Posts: 235

Rep: Reputation: 46
Moin,

what does identify (from the ImageMagick package) or gm identify (from the GraphicsMagick package) say about the files?

Jan
 
Old 06-16-2009, 01:23 PM   #6
Dralnu
Member
 
Registered: Jul 2005
Posts: 335

Original Poster
Rep: Reputation: Disabled
I found out what the problem was: permissions. I had everything set to -rw-r----- instead of -rwxr-----. I changed it, and its working fine now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a nautilus via a bash cron script rose_bud4201 Programming 3 06-20-2008 09:26 AM
SUSE10.1 : bash query : saving input to file linuxFNG Linux - Newbie 3 03-07-2008 12:23 PM
Bash script to sort image files dtcs Programming 5 09-26-2006 09:50 PM
opening new bash tabs or consoles from a script Nice-n-Slow Programming 7 07-12-2004 09:25 AM
Image Comparison With Bash Script smcallis Programming 4 06-30-2004 12:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration