Partager via


Recompress your digital pictures to save space

I have 23,000 digital pictures and movies taking many gigabytes of storage from the past decade or so. The more recent ones are larger, because higher resolution cameras were more readily available. I have a few copies of the entire collection on various computers for backup. I would like to save some space, perhaps to get more disk space to copy a Virtual PC image onto my machine for a conference. I can recompress these pictures to take less space. (I won’t change the master copy.) I display the pictures on the screen much more often than I print them. In fact, all of the pictures get displayed via my screen saver. Of course, multi-megapixel cameras are much higher resolution than they need to be for display on a screen. See this link for a chart of camera resolution vs photo print size.

I believe some digital cameras have the ability to recompress pictures already stored: if you run out of space while on vacation, you can choose an option on the camera to recompress (perhaps changing resolution) to get more space. Has anybody seen this feature?

(Another way to get more space: my picture query program will automatically substitute the VFP generated thumbnail for display if the full size picture isn’t found, so I can delete a year’s worth of photos and still see the photos as enlarged thumbs)

I used my treemap program to get the full breakdown of space being taken by the pictures. Recompressing 2004 will get the most space.

Run the program below to recompress a JPG and show it (by default) with Windows Picture and Fax Viewer. Zoom in on the original and resampled files: you can see the deterioration in quality when you zoom on the resampled picture.

The result for that picture is indistinguishable unless I zoom in, and the file size went from 1600 K to 245K, or about 6.5 times smaller! That’s about %85 space saved.

Images that have a lot of detail (like a complex pattern on wallpaper) don’t compress as well as simpler images (like a blank wall), so your mileage will vary.

cPict=GETFILE("jpg","JPG please","",0,"Choose a picture to recompress")

cOutfile="d:\t.jpg"

LOCAL oImage as gpImage OF (HOME()+"ffc\_gdiplus")

oImage=NEWOBJECT("gpImage",HOME()+"ffc\_gdiplus","",cpict)

oImage.SaveToFile(cOutfile,"image/jpeg","Quality=20")

ADIR(aa,cOutfile)

nSizeNew=aa[1,2]

ADIR(aa,cPict)

nSizeOrig=aa[1,2]

?"Orig Size = ",TRANSFORM(nSizeOrig,"999,999,999")

?"New Size = ",TRANSFORM(nSizeNew,"999,999,999")

?"# bytes smaller = ", TRANSFORM(nSizeOrig - nSizeNew,"999,999,999")

?"# times smaller", nSizeOrig / nSizeNew

?"% savings=", 100*(nSizeOrig - nSizeNew)/nSizeOrig

! &cOutfile

Comments

  • Anonymous
    November 29, 2005
    I wonder if you know what's the best way for long term backup/storage. Should I burn the files on recordable CD, or put them on a hard disk (that's usually not powered up) ?

  • Anonymous
    November 29, 2005
    I have written a similar utility (vfp digital album) for my personal photographs but I wonder how can you uniquely identify each photo. Is there any GDI function that returns a unique string or number for every photo?
    How can someone avoid double entries in a dbf?

    Thank you
    Vassilis

  • Anonymous
    October 11, 2007
    I have many digital pictures, and I'd like to put some of my favorites on my SmartPhone . However the

  • Anonymous
    October 11, 2007
    PingBack from http://msdnrss.thecoderblogs.com/2007/10/12/resize-your-pictures-for-your-phone-or-pocket-pc/

  • Anonymous
    March 13, 2008
    I was running out of space again on my notebook. As years go by, digital cameras can take pictures with

  • Anonymous
    March 13, 2008
    I was running out of space again on my notebook. As years go by, digital cameras can take pictures with

  • Anonymous
    June 02, 2009
    PingBack from http://woodtvstand.info/story.php?id=88907

  • Anonymous
    June 13, 2009
    PingBack from http://thestoragebench.info/story.php?id=2217