Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to recover a corrupted .xcf file? (or just one layer from it?)

4,984 views
Skip to first unread message

Mark

unread,
Dec 4, 2009, 3:42:50 PM12/4/09
to
Hi experts, I need some help here.
GIMP: 2.2.13
OS: Ubuntu 7.04 Feisty kernel: 2.6.20-17-generic

I have an .xcf file I created that is now unreadable: Gimp says
"Opening -filename- failed: Plug-in could not open image."
Kolourpaint says "The file may be corrupt."
The image has two layers, one can be discarded, so even if I could
extract one layer from it as a PNG or something that would save my
bacon. I've heard about using dd or somesuch to do such things but
I've not used dd before, it sounds a little scary.

What happened you ask? Well, the file is on an external (IDE) drive.
While editing it in Gimp I unknowingly had an "Open" dialogue box in
the background for a while, and during this time I turned off and
turned on the external drive twice. Somehow Nautilus got into a state
where it thought I had multiple external drives, and so they showed up
as different external media called "Drive", "Drive_", and "Drive__" ,
with only the last one accesible. This also was reflected in Gimp's
"File Open" dialogue. So I eventually saved my file onto "Drive__".
Later on I noticed this weirdness, closed Gimp and restored the
external media to being mounted on "Drive". And then the file (but
just that one file) can't be opened. I didn't recall exactly the
chain of events that led to the weird condition with multiple mount
points, and I tried and failed to recreate it.

Things I've tried:
- editing fstab and mounting the drive at "Drive__" and reopening the
file, didn't work
- opening the file in Kolourpaint, didn't work
- xcftools can't read it at all, it says "
xcf2png: Corrupted or malformed XCF file:
Not an XCF file at all (magic not recognized)
Warning: program returned non-zero exit code #125
"
when I try to view it with xcfview.

Can any experts help me out here? Either opening the file
successfully (in Gimp or otherwise) or extracting a layer from it?

Many thanks!

Mark

rich

unread,
Dec 5, 2009, 5:22:33 AM12/5/09
to
On Fri, 04 Dec 2009 12:42:50 -0800, Mark wrote:

> Hi experts, I need some help here.
> GIMP: 2.2.13
> OS: Ubuntu 7.04 Feisty kernel: 2.6.20-17-generic
>
> I have an .xcf file I created that is now unreadable: Gimp says "Opening
> -filename- failed: Plug-in could not open image." Kolourpaint says "The
> file may be corrupt." The image has two layers, one can be discarded, so
> even if I could extract one layer from it as a PNG or something that
> would save my bacon. I've heard about using dd or somesuch to do such
> things but I've not used dd before, it sounds a little scary.
>

<big snip>

Interesting but it is not looking good, seems the header is corrupt.
A quick test - using a 2 layer .xcf file and a hex editor

1. Corrupt end of file (overwrite a section with zeros)
Gimp will open the first layer with this message

This XCF file is corrupt! I have loaded as much of it as I can, but it
is incomplete.

This did indeed load the first layer but not the second.
-------------------

2. Corrupt section near the front - this message

Opening '/home/rich/test2.xcf' failed:

This XCF file is corrupt! I could not even salvage any partial image
data from it.
------------------

3. Corrupt header - the first 400 odd bytes

Opening '/home/rich/test3.xcf' failed:

GIMP XCF image plug-In could not open image
-----------------

Tried an imagemagick conversion on each - no good.

Tried grafting a header from a new file into the file with the corrupt
header - back to option 2 - no good.

It might still be worth using a hex editor just to see how much of the
file is corrupt. If it is a few bytes in the header then it might be
repairable. If it is a big block of zeros then I think it is deceased.

--
rich

Mark

unread,
Dec 5, 2009, 2:23:58 PM12/5/09
to
On Dec 5, 2:22 am, rich <r...@nohome.com> wrote:
<snip>

Thanks for the tests and info, Rich. I fiddled with the file for an
hour or so with a hex editor and tried similar things as you and also
had no luck, prepending a blank image, merging with a working file,
etc. But I couldn't easily figure out where the header stops and
where the content starts. I don't see any large zero blocks, at least
any large blocks that look different from another (working) file.

If emailed you the file would you be able to have a look at it
yourself? (it is 8mb)

Many thanks

Mark

rich

unread,
Dec 6, 2009, 4:28:57 AM12/6/09
to

I can try but it is unlikely that I can do anything that you have not
already done.
Rather than an email can you pop it onto a free file sharing service such
as www.rapidshare.com or www.filefront.com

--
rich

Mark

unread,
Dec 7, 2009, 4:35:36 PM12/7/09
to
On Dec 6, 1:28 am, rich <r...@nohome.com> wrote:
...

>
> I can try but it is unlikely that I can do anything that you have not
> already done.
> Rather than an email can you pop it onto a free file sharing service such
> aswww.rapidshare.comorwww.filefront.com
>
> --
> rich

Rich, many thanks again for helping out another anonymous web
denizen. I'd appreciate any time you could spend fiddling with it.

http://rapidshare.com/files/317715588/newpage10.xcf.html

Mark

rich

unread,
Dec 8, 2009, 1:40:36 PM12/8/09
to

I think it is scrap, maybe someone can have a go.

My findings

a gimp .xcf file is composed of segments
a header
the layer(s) - starting with their name(s)
Background - starting with "Background"

Your file certainly looks like it is a .xcf from 'somewhere' to the end,
the last few hundred bytes match, however nowhere is there anything to
mark the start of a 'Background' which would be the last segment.

Very, very long shot
Since it came from an external drive have you run photorec on the drive -
part of the testdisk package (should be in the ubuntu repo).
If you have not used the external drive too much there might be something
to recover.


--
rich

Mark

unread,
Dec 10, 2009, 1:47:03 PM12/10/09
to
Rich, thanks for trying. I have run Photorec on the drive but I
didn't have enough space to store the (massive) amounts of stuff that
it found - the drive it's on is large and well-used. And it would
probably take more time to sort through the recovered stuff than to
reconstruct the image.

I can reconstruct the image as it was part of a large series and I can
deduce what is in it. Thanks again for trying. I'll back up more
frequently next time ...

mark

jemina.w...@gmail.com

unread,
Sep 15, 2014, 7:12:22 AM9/15/14
to
Hey, my Gimp 2.6 corrupted a file this morning, it was saving the xcf image when my whole computer froze, and I had to restart, since there was no way it could have recovered from it by itself.

I managed to recover the image by opening the files properties, and having my computer look for back-up points. Luckily, it found several and one of the previous day.

So to recover most of your work;

Your xcf file -> properties -> Earlier versions aka back-up points (should be on the last page)

It'll take a while but it should find you several days of back-up points, if there are any.
Pick the latest point when the file was healthy -> load back-up -> yes

Done.
Worked like a wonder.

I almost cried when there were no instructions how to save it, so I thought I'd post somewhere how I solved it. : >

theter...@gmail.com

unread,
Dec 29, 2014, 1:58:16 PM12/29/14
to
Will this also work with Gimp 2.8? And where does one exactly go after 'Properties' is selected? A file that I have been working on for over a month suddenly won't open anymore and I dont know what to do.

fantasi...@gmail.com

unread,
Jan 8, 2015, 5:34:49 AM1/8/15
to
On Monday, 29 December 2014 19:58:16 UTC+1, theter...@gmail.com wrote:
> Will this also work with Gimp 2.8? And where does one exactly go after 'Properties' is selected? A file that I have been working on for over a month suddenly won't open anymore and I dont know what to do.

Did you get this to work in 2.8? I have the same issue and can't find where to access an older version of the file?

infohear...@gmail.com

unread,
May 14, 2015, 1:53:31 PM5/14/15
to
____

Hi everyone,

I'm experiencing the same issue where a file I was working on (which saved just fine) suddenly will not open. Any updates on this topic are much appreciated! I am working on a mac, no luck installing the auto save plugin yet.

- Mike

kyoko...@gmail.com

unread,
Aug 1, 2015, 9:10:32 PM8/1/15
to
I also need help, I was working on a Venus portrait, and I closed everything properly but the file is still corrupt.

i don't know what to do and I don't want to restart oAo

Peter Mc Donough

unread,
Aug 2, 2015, 6:38:34 AM8/2/15
to
Am 02.08.2015 um 03:10 schrieb kyoko...@gmail.com:
> I also need help, I was working on a Venus portrait, and I closed everything properly but the file is still corrupt.
>
> i don't know what to do and I don't want to restart oAo
>
With some luck you will have a copy in one of the tmp-dirctories.
Check gimp - settings -folders

cu
Peter

Peter Mc Donough

unread,
Aug 2, 2015, 6:42:42 AM8/2/15
to
And don't forget to backup any finding before you try to recover the file

cu
Peter

0 new messages