Forgot Password
Pentax Camera Forums Home
 

Reply
Show Printable Version Search this Thread
11-28-2011, 01:19 PM   #1
Inactive Account




Join Date: Nov 2009
Posts: 6
The first jpg file in the folder is corrupted

I recently bought a 32GB Patriot SD Card LX Series Class 10 for my Pentax Kx.

After using it for several months I have noticed something strange.
It looks like whenever the Pentax created a new folder (mine set automatically
to create a new folder for each day) the first jpg file in that folder is
corrupted (looks like there are extraneous/errand data in the header.)
The rest of the files in the folder are OK (meaning I can open all of them
in any normal JPEG viewer.)

When I open the image using the JPEG Recovery Pro 5 Software, I can see
the full image correctly without any issues at all.
I have not seen this problem with my other SD cards (not a Patriot brand
and less than 32GB capacity.)

I was wondering if anybody has had this issue also.
Is this the problem with the SD card itself (or the brand), the camera,
or the size of the SD card?
Is there a way I can edit the header myself to fix the problem (I tried to
match the header with the good ones but I must have missed something
since the file is still not readable in normal JPEG viewer.)

Thanks.

11-28-2011, 02:56 PM   #2
Veteran Member
aleonx3's Avatar

Join Date: Jul 2007
Location: Brampton, Ontario
Photos: Gallery | Albums
Posts: 3,996
QuoteOriginally posted by satep Quote
I recently bought a 32GB Patriot SD Card LX Series Class 10 for my Pentax Kx.

After using it for several months I have noticed something strange.
It looks like whenever the Pentax created a new folder (mine set automatically
to create a new folder for each day) the first jpg file in that folder is
corrupted (looks like there are extraneous/errand data in the header.)
The rest of the files in the folder are OK (meaning I can open all of them
in any normal JPEG viewer.)

When I open the image using the JPEG Recovery Pro 5 Software, I can see
the full image correctly without any issues at all.
I have not seen this problem with my other SD cards (not a Patriot brand
and less than 32GB capacity.)

I was wondering if anybody has had this issue also.
Is this the problem with the SD card itself (or the brand), the camera,
or the size of the SD card?
Is there a way I can edit the header myself to fix the problem (I tried to
match the header with the good ones but I must have missed something
since the file is still not readable in normal JPEG viewer.)

Thanks.
It could be many things including those that you have not mentioned.
-try copy the whole folder to you computer hard drive and view the jpeg photo from there
-try to use another jpeg photo viewer
-try to reformat the SD card (save it in your hard drive first)

Hopefully, you will find out where the problem is... good luck.
11-28-2011, 03:04 PM   #3
Inactive Account




Join Date: Nov 2009
Posts: 6
Original Poster
QuoteOriginally posted by aleonx3 Quote
It could be many things including those that you have not mentioned.
-try copy the whole folder to you computer hard drive and view the jpeg photo from there
-try to use another jpeg photo viewer
-try to reformat the SD card (save it in your hard drive first)

Hopefully, you will find out where the problem is... good luck.
Thanks for your suggestions.

I did try #1 and #2 (with several photo viewers) with the same results: the first jpg file is
said to be corrupted and the rest of jpg files in the folder are fine.

I think I have tried #3 with the same result also (I formatted the SD card using
the camera itself.)
11-28-2011, 04:17 PM   #4
Site Supporter
Site Supporter




Join Date: Mar 2010
Location: Frankfurt am Main
Posts: 1,241
If re-formatting is no cure, and you are sure the K-x offically supports 32GB cards (I don't own a K-x), I would think there is a bug in the controller firmware (built-in in the SD card).

Can the "JPEG Recovery Pro 5 Software" save the restored file? If yes, is the length of the new file exactly the same as of the corrupted one? If the new file is some bytes longer, the error may be not in the header, but a wrong entry of the file length in the FAT (File Allocation Table) of the card. Copying to another medium does not use information of the header, but of the FAT of the source medium. If you try to read such a file with a viewer, the file lenght of the FAT would be not consistent with the header data, so many viewers will not be able to display the picture. Recovery software specialized on JPEGs will look for such errors and try to correct them.

11-28-2011, 10:16 PM   #5
Veteran Member




Join Date: Dec 2008
Location: Roodepoort, South Africa
Photos: Gallery | Albums
Posts: 3,561
Be aware that the recovery software might show the low quality integrated thumbnail instead of the real image; so your photo might actually be corrupted. But something is better than nothing

You can try to simulate the behaviour if you have a card reader. Insert the card in the reader, format on the PC, create a DCIM directory, create subdirectories and copy files/photos in there. If the behaviour is the same, it's the card; if it's not, no conclusions can be drawn.

You can test your card as well with additional software; for windows Download H2testw 1.4 Free - Check your USB for errors with this tool. - Softpedia; it will probably not pick up your specific problem, but will test your card in a generic way.
11-29-2011, 11:50 AM   #6
Inactive Account




Join Date: Nov 2009
Posts: 6
Original Poster
Thank you for both of your suggestions above. They are helpful.

Yes I only used the demo version of the recovery software so
all I can see is a smaller version of the original image (so the
size of the image is not the same as the original.)
The smaller version of the image looks correct.
So far I have not lost important images and the cost of the
software is almost twice the cost of the SD card so I have
not purchased the software.

This morning (a new day so it would have created a new folder),
I took 2 photos with the lens cap on in Manual mode
so the image should be all black.
Sure enough the first photo (file) has problem but
the second photo is fine.

On the SD card:
For the bad photo the size is 263,033 bytes (size on disk is 294,912 bytes)
For the good photo the size is 263,415 bytes (size on disk is 294,912 bytes)

After I copied them to HDD:
For the bad photo the size is 263,066 bytes (size on disk is 266,240 bytes)
For the good photo the size is 263,415 bytes (size on disk is 266,240 bytes)

Interesting to note that for the good file the size is the same on the SD card
and the one copied to HDD.

Comparing the bad and the good file, I can see that the bad file at least
have the first 4 bytes filled with unknown values. However even after
I removed the first 4 bytes on the bad file, IrfanView still cannot display
the file. I observed that after I removed the first 4 bytes, the first 200 bytes
or so of the bad and good files look exactly the same.

I also tested the SD card on a laptop by creating a new folder inside the DCIM
folder and copying a jpg file into that new folder. The jpg file copied there has no
problem even though it is the first file on that folder (which normally will be a
problem if created by the Kx itself.)

I also run the H2testw and it did not report any issues.

Do my findings point to a problem created by the Kx itself?
11-29-2011, 01:15 PM   #7
Site Supporter
Site Supporter




Join Date: Mar 2010
Location: Frankfurt am Main
Posts: 1,241
"Do my findings point to a problem created by the Kx itself?"

Maybe, maybe not. It certainly is not the camera hardware, but could still be the camera firmware, the card controller firmware, the card controller hardware, or an incompatbility between the camera and the card (soft-/firmware related), meaning a different interpretation of the standard by Pentax and the card manufacturer.

The FAT32 file system is still an expansion of the FAT system developed for early MSDOS - an OS which does not know about file "types" and file "headers". So test tools like H2testw do not compare file type related file headers with FAT entries. If H2testw says OK it means the file system itself does not show an inconsistensy.

My idea was (I may be wrong), that there is an inconsistancy between the FAT data and the header data, which would of course not be shown in H2test, if FAT data in itself are correct. But when writing data to disk then FAT data would be used, allowing another file to hijack some bytes of the next file written. The disk structure would still be OK, but the 1rst file could be corrupt. In this case, if you would repeatedly write files and delete single pictures (including the first one in a directory), also another file could be affected instead of the first one.

I am not sure we will be able to find out the cause by such tests, but the fact that the header (the BEGINNING of the first file) maybe modified could mean I am wrong. It would be interesting to see what happens, if you take just ONE picture with a freshly formatted card, and the same if the card was formatted off the camera. Or, in other words, will the file be corrupted when it is written, or when THE NEXT FILE is written. Also it would be interesting to see, whether these 4 bytes (of the already corrupted file) change after you write a THIRD file to the card.

I have completely forgotten about the internal structure of a FAT, and to update would mean to bury deeply in 15 years old Microsoft operating system handbooks (would have to find them first, maybe in some forgotten box in the cellar). Programming today is too often just linking existing libraries.

EDIT:
It does not make much sense to compare the file sizes shown by the OS of the same file between the card and the HD. The physical structure and data organisation of the data on the card is a top secret of the manufacturers, as it is a main factor for speed and life cycle of such a card. The OS only sees a (virtual) mapping provided by the card firmware, and we don't know about things like real cluster sizes etc. The size in bytes could be rounded to fit into that internal mapping.


Last edited by RKKS08; 11-29-2011 at 01:33 PM.
Reply

Bookmarks
  • Submit Thread to Facebook Facebook
  • Submit Thread to Twitter Twitter
  • Submit Thread to Digg Digg
Tags - Make this thread easier to find by adding keywords to it!
brand, camera, card, file, folder, header, image, jpeg, pentax help, photography, sd

Similar Threads
Thread Thread Starter Forum Replies Last Post
Export RAW folder(s) in LR3 keeping folder structure. Chaos_Realm Digital Processing, Software, and Printing 2 06-16-2011 05:54 PM
Folder/file name GordZ Pentax DSLR Discussion 7 02-11-2010 06:12 PM
Pentax File Folder Icons for Mac jmax Photographic Technique 2 08-16-2009 09:42 AM
Corrupted RAW file. Bad SD card? tybeck Photographic Technique 1 04-17-2008 05:38 AM
Read ALL the EXIF data in a PEF RAW file or JPG - Freeware application Rickster Photographic Technique 0 07-11-2007 05:15 AM



All times are GMT -7. The time now is 12:52 AM. | See also: NikonForums.com, CanonForums.com part of our network of photo forums!
  • Red (Default)
  • Green
  • Gray
  • Dark
  • Dark Yellow
  • Dark Blue
  • Old Red
  • Old Green
  • Old Gray
  • Dial-Up Style
Hello! It's great to see you back on the forum! Have you considered joining the community?
register
Creating a FREE ACCOUNT takes under a minute, removes ads, and lets you post! [Dismiss]
Top