This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Paint Shop Pro support > January 2006 > File Size Bloat?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author File Size Bloat?
TuxedoMonkey

2006-01-11, 6:47 pm

Hi, all! I'm a semi-noob, mostly because I learn PSP (I have v.8) by
fiddling around rather than using tutorials and such.

Anyway, I have a somewhat obscure question. As I am aware, and as
people have pointed out on previous group postings, the actual file
size of an image can vary when you save it. For example, I can open an
uncompressed image and save it with compression to make the file take
less memory. I suppose I could also open a compressed image and save it
with no compression to make it a larger file.

Recently, however, I noticed something strange about saving files in
PSP. First, I download an image (the Google logo, for example) and save
it as a file. Now I duplicate it, so I have two copies of exactly the
same image. If I use Windows to see the file properties, they have
exactly the same number of pixels, resolution, file size, etc. Now I
open one of the copies in PSP, do nothing except hit "Save," and close
the program. When I check the properties of the files, the one I just
opened and saved has exactly the same properties, but the file size is
bigger! What's up with that?

As I said, it's not a matter of compression or format, because I have
verified this issue with several formats and compression levels as well
as with uncompressed graphics. What's going on? Is PSP writing hidden
information to the file? The change is fairly small, maybe changing a
250K image to 251K, but I would rather not add 1K to my images unless
I'm actually modifying them!

Any help would be appreciated, and hello again!

Trev

2006-01-11, 6:47 pm


"TuxedoMonkey" <TuxedoMonkey@yahoo.com> wrote in message
news:1136990910.654954.304220@f14g2000cwb.googlegroups.com...
> Hi, all! I'm a semi-noob, mostly because I learn PSP (I have v.8) by
> fiddling around rather than using tutorials and such.
>
> Anyway, I have a somewhat obscure question. As I am aware, and as
> people have pointed out on previous group postings, the actual file
> size of an image can vary when you save it. For example, I can open an
> uncompressed image and save it with compression to make the file take
> less memory. I suppose I could also open a compressed image and save it
> with no compression to make it a larger file.
>
> Recently, however, I noticed something strange about saving files in
> PSP. First, I download an image (the Google logo, for example) and save
> it as a file. Now I duplicate it, so I have two copies of exactly the
> same image. If I use Windows to see the file properties, they have
> exactly the same number of pixels, resolution, file size, etc. Now I
> open one of the copies in PSP, do nothing except hit "Save," and close
> the program. When I check the properties of the files, the one I just
> opened and saved has exactly the same properties, but the file size is
> bigger! What's up with that?
>
> As I said, it's not a matter of compression or format, because I have
> verified this issue with several formats and compression levels as well
> as with uncompressed graphics. What's going on? Is PSP writing hidden
> information to the file? The change is fairly small, maybe changing a
> 250K image to 251K, but I would rather not add 1K to my images unless
> I'm actually modifying them!
>
> Any help would be appreciated, and hello again!
>


When you save a jpeg in psp (gif is similar ) psp uses the compression
setting that is selected in the options tab or in the optimizer, Using the
optimizer is best. This may be the default setting or your last used
setting.
Next point compressed images are no longer compressed when opened the
missing pixels that Jpeg tossed away are re crated to look as it did before
compression. Or more correctly as near as possible. So it has to be
compressed again if you made any changes and will be compressed at what ever
ratio you pick. so it could be bigger or smaller in file size. This is also
the reason its not recommended to re save as jpeg unless necessary as Each
time its opened modified and resaved more of the original pixels are lost
and the picture quality worsens until at some point all you have are
guestamated pixels.

If as you said you did not alter the image psp would not save Ie. write to
the file but just close it. so you mused have done something maybe saved as>


Fred Hiltz

2006-01-11, 6:47 pm

TuxedoMonkey wrote:
> ... First, I download an image (the Google logo, for
> example) and save it as a file. Now I duplicate it, ...
> Now I open one of the copies in PSP, do nothing except hit
> "Save," and close the program. When I check the properties
> of the files, the one I just opened and saved has exactly
> the same properties, but the file size is bigger! What's up
> with that?...


In addition to what Trev wrote, the file can contain more than just
the image: metadata that varies with the format (EXIF with JPG
files, for example) and of course the slack space due to the file
system writing full blocks.

You can test equality of the image by reading back the just-written
duplicate and using Image > Arithmetic to subtract it from the
original. The result will be a pure black image if you saved the
duplicate in a lossless format. Not with JPEG, though.
--
Fred Hiltz, fhiltz at yahoo dot com


TuxedoMonkey

2006-01-11, 6:47 pm

Is there any way that I can prevent it from writing any of this extra
data?

As I said, I really don't think it's a compression issue. Let me give
you an example of something I'm doing right now, and I'll try to be as
explicit as I can. I have an *uncompressed* TGA file that I have
downloaded. I duplicate that file. Windows confirms that both images
have the same resolution (32-bit, if it matters), dimensions, and file
size. I open the copy in PSP, click the "Save" icon on the toolbar, and
close the program. That's all I do. The copy is now 1KB larger than the
original. It has the same dimensions and resolution, and appears
unchanged. I get the same result if I "save as" the copy and explicitly
confirm that I want no compression.

Repetition does not continue to increase the file size; it only happens
the first time. Is PSP somehow marking the file with a "modified using
PSP" tag or something? Is it encoded slightly differently with PSP than
with whatever program was used to create the original file?

Fred Hiltz

2006-01-11, 6:47 pm

TuxedoMonkey wrote:
> Is there any way that I can prevent it from writing any of
> this extra data?


Look for options under the Options button of the File > Save As
dialog. I do not know whether the TGA format has optional extra
data.

> As I said, I really don't think it's a compression issue.
> Let me give you an example of something I'm doing right
> now, and I'll try to be as explicit as I can. I have an
> *uncompressed* TGA file that I have downloaded. I duplicate
> that file. Windows confirms that both images have the same
> resolution (32-bit, if it matters), dimensions, and file
> size. I open the copy in PSP, click the "Save" icon on the
> toolbar, and close the program. That's all I do. The copy
> is now 1KB larger than the original. It has the same
> dimensions and resolution, and appears unchanged. I get the
> same result if I "save as" the copy and explicitly confirm
> that I want no compression.
>
> Repetition does not continue to increase the file size; it
> only happens the first time. Is PSP somehow marking the
> file with a "modified using PSP" tag or something? Is it
> encoded slightly differently with PSP than with whatever
> program was used to create the original file?


In your first post you wrote that you were saving a duplicate. Now
you are opening and saving without modifying. As Trev wrote, if
there really has been not change, PSP does not re-save the file.

If the few hundred bytes increase in a large image file really
bothers you enough to chase it down, investigate what Windows does
in whichever file system you are using, study a binary comparison of
the files, compare the images as I wrote, and test with other file
formats written by different applications. Perhaps a pattern will
emerge. All Windows programs call Windows for the actual writing,
I'm sure you know.
--
Fred Hiltz, fhiltz at yahoo dot com


TuxedoMonkey

2006-01-11, 6:47 pm

When I said "duplicate" in the first post, I meant using the Windows
copy-paste on the file, not in PSP. You're also correct that it's not a
huge issue having one file increase by 1K, but it adds up with multiple
images. It also plays havoc when modding graphics for some programs
that expect a file size exactly the same as the original.

I agree that the file should not be re-saved if I don't actually modify
it in the program. However opening, clicking "Save" and exiting
increases the file size! If it's easier to think about, take the
example where I open the image and immediately "Save As" to a slightly
different file name, which produces the same result.

The idea that XP handles it differently when it writes the image rather
than just duplicating the file is a good idea. However, if I open a BMP
or GIF in Paint, I can immediately Save As under a different name with
no effect on file size. Doing the same thing on the same file with PSP
bumps up the file size slightly.

Since you mentioned looking at the binary, can you recommend a way to
get into the image code without totally screwing it up?

Fred Hiltz

2006-01-11, 6:47 pm

TuxedoMonkey wrote:
> When I said "duplicate" in the first post, I meant using
> the Windows copy-paste on the file, not in PSP. You're also
> correct that it's not a huge issue having one file increase
> by 1K, but it adds up with multiple images. It also plays
> havoc when modding graphics for some programs that expect a
> file size exactly the same as the original.
>
> I agree that the file should not be re-saved if I don't
> actually modify it in the program. However opening,
> clicking "Save" and exiting increases the file size! If
> it's easier to think about, take the example where I open
> the image and immediately "Save As" to a slightly different
> file name, which produces the same result.
>
> The idea that XP handles it differently when it writes the
> image rather than just duplicating the file is a good idea.
> However, if I open a BMP or GIF in Paint, I can immediately
> Save As under a different name with no effect on file size.
> Doing the same thing on the same file with PSP bumps up the
> file size slightly.
>
> Since you mentioned looking at the binary, can you
> recommend a way to get into the image code without totally
> screwing it up?


None in particular. There are many hex-dump programs, of course, and
you can find specs for most formats on line. Happy hunting.
--
Fred Hiltz, fhiltz at yahoo dot com


Marjolein Katsma

2006-01-12, 6:50 pm

Fred Hiltz (not@home.ca) wrote in news:3eKdncOG8pZQ3VjeRVn-
rA@adelphia.com:

> In your first post you wrote that you were saving a duplicate. Now
> you are opening and saving without modifying. As Trev wrote, if
> there really has been not change, PSP does not re-save the file.


Something's going on though...

I just tried this, similar to what OP did:
- Used Windows to copy a .bmp file (comparison utility shows they are
identical)
- opened the copy in PSP 7, hit the save button, close PSP 7

Although both files are still the same size, a file comparison utility
shows they are *not* identical; viewing with the hex compare shows
several bytes in the file header are different.

Same exercise with the same image and PSP 8 shows a similar (but not
identical) change in the file header. I don't know enough about the
internals of .bmp to determine what those bytes are; there's no visual
difference in the image compare utility.

Same with a .jpg image and PSP 8 (ope, save, close PSP 8) results in a
differnet physical size as well (smaller, rather than larger); visual
comparison also shows a difference here.

But this means that at least PSP 7 and 8 do not just *close* a file when
you save it unchanged... looks rather like PSP is simply applying
whatever its current settings are for those file types when saving, even
if you do not change the file and even if you do not actually use teh
save as... dialog so you can see/set the options: it really *does* save
the files. This is also shown by comparing the file creation and
modification time stamps after saving unchanged from PSP: they are
different; that doesn't happen if a file is merely closed.


--
Marjolein Katsma
*Help with HomeSite/Studio: http://hshelp.com/
*Travel blog: http://blog.iamback.com/
*Spam reporting addresses: http://banspam.javawoman.com/report3.html
Rob McAninch

2006-01-13, 6:40 pm

Marjolein Katsma <nobody@example.net> wrote in
<news:Xns9749A9DB63FB8iamback@194.109.133.242> :

> But this means that at least PSP 7 and 8 do not just *close* a
> file when you save it unchanged...


PSP9 does the same.

> looks rather like PSP is simply applying whatever its current
> settings are for those file types when saving, even if you do
> not change the file and even if you do not actually use teh
> save as... dialog so you can see/set the options: it really
> *does* save the files.


This is a correct behavior for the software. All PSP knows is you
opened some file and now you are saying save it. So it does so.
In essence a call to save simply says take this file and write it
to disk (I doubt anything else is required). If you changed any
default settings in the save dialogs then it applies those.
Additionally, in the case of a lossy file like jpeg then it's
going to apply another round of compression.

Of course the software could also choose to be aware of whether
anything will actually be modified, and not do a save if nothing
will change. My text editor doesn't allow me to save unless
something is changed (of course this is a much simpler file and
doesn't have all the save options as PSP).

> This is also shown by comparing the file creation and
> modification time stamps after saving unchanged from PSP: they
> are different; that doesn't happen if a file is merely closed.


Indeed. That's why you should work in a lossless format, repeated
saves don't harm the file, then convert to your final format when
you're finished. Repeated saves may cause the file to grow with
metadata about the file but the important part doesn't get
harmed.

--
Rob McAninch
http://rock13.com
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews