RPTools.net

Discussion and Support

Skip to content

It is currently Sat May 25, 2013 1:48 am 






Reply to topic  [ 7 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Dragon
 
Joined: Sun Mar 22, 2009 1:25 am
Posts: 957
 Post subject: Image Tag Remover
PostPosted: Wed May 27, 2009 10:50 pm 
Okay, I have a couple programs I use to strip out everything except image data from JPEGs and PNGs. Does anyone know of a nice open source, freeware, or even commercial (extra credit: cross platform) solution that would handle both formats.. and maybe more? Batch "cleaning" is a requirement.

_________________
My Wiki User Page


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Image Tag Remover
PostPosted: Thu May 28, 2009 6:30 pm 
Should be pretty simple to do in Java, actually! Since Java has libraries for those two, just open up the image file, copy the image data to a new object, then write the object out.

It should also be pretty easy using the EXIF and PNG modules in Perl.

I'll take a look at using Perl if you can be specific about what you want or don't want. (I've written some Perl code that looks at the EXIF data in JPEG files and extracts date stamps, camera settings, and similar stuff.)

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sun Mar 22, 2009 1:25 am
Posts: 957
 Post subject: Re: Image Tag Remover
PostPosted: Thu May 28, 2009 7:38 pm 
Yeah, I don't doubt the simplicity of such a task, I was just hoping someone might know of an existing solution; as I have too much on my plate right now to code my own.

As for what I do or don't want: I only want the minimum data required to render the image.

I've noticed that even if I explicitly tell Photoshop to not save any extraneous data, it still will. With larger images it's really a non-issue, but if you're talking about small images (~20KB) the extra crap is taking up like 40% of that.

_________________
My Wiki User Page


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Image Tag Remover
PostPosted: Thu May 28, 2009 10:01 pm 
Do you have Perl installed? I have a solution for you.

It requires the Image::ExifTool module, but on Windows that can be easily installed using PPM (the Perl Package Manager).

I'm not sure what your environment is though, so I'm not sure how it should execute? How about the command line requires a directory name and a list of image files (or wildcard)? The directory is where all of the images will be stored after being processed. But it won't automatically do subdirectories (pain in the neck in any language ;)). It will handle both JPEG and PNG files (and about two dozen more, but you didn't ask for those).

I've tested it on a JPEG and it went from 137,888 bytes to 134,635 bytes. A hex dump on the resulting output doesn't show any remaining comments. Even thumbnails embedded in the image will be removed by this program.

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sun Mar 22, 2009 1:25 am
Posts: 957
 Post subject: Re: Image Tag Remover
PostPosted: Thu May 28, 2009 10:30 pm 
OpenSolaris, so it depends on which version of Perl is required >.< ; but I spend a good deal of time in a Windows VM (too much time actually; too many Windows-only apps), and it has no issues with Perl... that I know of.

Not supporting sub-directories isn't an problem. Those CL parameters sound simple enough.

_________________
My Wiki User Page


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Image Tag Remover
PostPosted: Thu May 28, 2009 11:59 pm 
Here you go. I had to use a .txt extension, so rename it to something pretty.

You'll need to install Image::ExifTool. If you're not familiar with that, use perl -MCPAN -e install Image::ExifTool and then go get a cup of coffee. If your installation has never had CPAN configured, there'll be about a dozen questions to answer first. Most can be defaulted by hitting Enter, but it's a good idea to pick a CPAN mirror geographically near you. And if you don't install it as root, you can only configure the module for your own use. I don't recall if the module requires a compiler, but I don't think it does, although it does require a make command.

I just tested it by trying:

Code:
./cleanup.pl t Misc/*.jpg

And it correctly stripped off the Misc/ from the input filename and then dumped the result into the ./t directory.


File comment: Perl script to clean image files
cleanup.txt [645 Bytes]
Downloaded 16 times

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)
Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Sun Mar 22, 2009 1:25 am
Posts: 957
 Post subject: Re: Image Tag Remover
PostPosted: Fri May 29, 2009 3:35 am 
Very cool, thanks man. :)

_________________
My Wiki User Page


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 7 posts ] 

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 post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





cron

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman