Bug 128309 - Apple PICT: "Quicktime and a TIFF uncompressed decompressor are needed to see this picture"
Summary: Apple PICT: "Quicktime and a TIFF uncompressed decompressor are needed to see...
Status: NEW
Alias: None
Product: Document Liberation Project
Classification: Unclassified
Component: General (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: macOS-UI-polish
  Show dependency treegraph
 
Reported: 2019-10-22 00:14 UTC by MarjaE
Modified: 2022-09-03 10:28 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
An affected file (11.14 MB, application/octet-stream)
2019-10-22 17:21 UTC, MarjaE
Details
The picture contained in the previous attachment, (11.10 MB, image/pict)
2019-10-24 12:44 UTC, osnola
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MarjaE 2019-10-22 00:14:04 UTC
Just opening an old Appleworks drawing.

An image in the background gives the above error.

Also, LibreOffice opens these drawings as .odt instead of .odg, and doesn't allow users to save as .odg.
Comment 1 Xisco Faulí 2019-10-22 14:21:46 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Comment 2 MarjaE 2019-10-22 17:21:41 UTC
Created attachment 155242 [details]
An affected file

Thank you, attaching this affected file.
Comment 3 QA Administrators 2019-10-24 02:41:51 UTC Comment hidden (obsolete)
Comment 4 osnola 2019-10-24 12:44:55 UTC
Created attachment 155279 [details]
The picture contained in the previous attachment,

This file contains the attached Apple Picture, libmwaw retrieves it correctly, but the internal ApplePict filter does not know how to display...

More precisely, the content of this picture is composed of a QuickTime Tiff Bitmap (op 8200) that LibreOffice(filter/source/graphicfilter/ipict.cxx) does not know => he only prints the replacement string...

Juste for note, the parsing of this picture:
000000
000000 [FileHeader:dim=(0x0<->2448x1584),pict2[2:0],res=150x150,dim[optimal]=(0x0<->2448x1584),]00000000000006300990001102ff0c00fffe00000096000000960000000000000630099000000000
000028 [Entries(HiliteDef):]001e
00002a [Entries(Region)[clip]:(0x0<->2448x1584),]0001000a0000000006300990
000036 [Entries(Rectangle)[erase]:(0x0<->2448x1584)]00320000000006300990
000040 [Entries(Color)[op]:#808080]001f800080008000
000048 [Entries(Quicktime):mat=[1,_,_,_,1,_,_,_,1,],mode=64,srcRec=(0x0<->2448x1584),accuracy=768,maskSize=a,]820000b1859a000000010000000000000000000000000000000100000000000000000000000000004000000000000000000000000000000000400000000006300990000003000000000a
000092 [Quicktime:mask,]000a0000000006300990
00009c [Quicktime:imageDesc,creator=tiff,vendor=appl,quality[spacial]=400,src[sz]=2448x1584,res=150x150,dataSize=b184ce,frame[count]=1,TIFF (Uncompressed),depth=24,]0000007e746966660000000000000000000000006170706c000000000000040009900630009600000096000000b184ce000113544946462028556e636f6d70726573736564290000000000000000000000000018ffff|0000000c73747270000000110000000c696e6478000000010000000c746966630000000100000000
Skip : 00011a-b185e7


b185e8 [Entries(PenSize):132x174,]000700ae0084
b185ee [Entries(PenSize):1x1,]000700010001
b185f4 [Entries(FontId):3,]00030003
b185f8 [Entries(TextFace):]00040000
b185fc [Entries(FontSz):12]000d000c
b18600 [Entries(TextRatio):num=2448x2448,denom=2448x2448,]00100990099009900990
b1860a [Entries(TextData):1170x780,QuickTimeª and a]0028030c049210517569636b54696d65aa20616e64206100
b18622 [Entries(TextData):1115x792,TIFF (Uncompressed) decompressor]00280318045b20544946462028556e636f6d7072657373656429206465636f6d70726573736f7200
b1864a [Entries(TextData):1131x804,are needed to see this picture.]00280324046b1f617265206e656564656420746f20736565207468697320706963747572652e
b18670 [_]0000
b18672 [Entries(EOP):]00ff
Comment 5 Julien Nabet 2022-06-12 09:24:41 UTC
osnola: indeed I built locally by adding extra log and got these opcodes:
1e
1
32
1f
8200
7
7
3
4
d
10
28
28
28
0

https://developer.apple.com/library/archive/documentation/mac/QuickDraw/QuickDraw-461.html provides some info and for 8200
$8200	CompressedQuickTime	Data length (Long), data (private to QuickTime)	4 + data length

but how to keep on then? I mean is there some more detailed specs about pict format?
Comment 6 osnola 2022-06-12 10:33:18 UTC
Regarding the documentation, "Inside Macintosh: Imaging With Quickdraw" has a lot of information about the Apple Pict format, but the information about the CompressedQuickTime opcode 8200 is not very useful. 

I assumed that this code only encapsulated basic QuickTime data, so we need to find some documentation on the QuickTime format, perhaps https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFPreface/qtffPreface.html .

Note:
- A long time ago, I added a .pct filter in libmwaw (which is disabled in LibreOffice, in fact writerperfect checks if libmwaw finds an apple image file, and if so, refuses to convert it). This filter allows to retrieve some 8200 data. You can look for ApplePictParser::readQuicktime in src/lib/ApplePictParser.cxx...
Comment 7 Julien Nabet 2022-06-12 11:59:43 UTC
(In reply to osnola from comment #6)
> Regarding the documentation, "Inside Macintosh: Imaging With Quickdraw" has
> a lot of information about the Apple Pict format, but the information about
> the CompressedQuickTime opcode 8200 is not very useful. 
:-(

> I assumed that this code only encapsulated basic QuickTime data, so we need
> to find some documentation on the QuickTime format, perhaps
> https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/
> QTFFPreface/qtffPreface.html .
It seems to talk about movie format.

> 
> Note:
> - A long time ago, I added a .pct filter in libmwaw (which is disabled in
> LibreOffice, in fact writerperfect checks if libmwaw finds an apple image
> file, and if so, refuses to convert it). This filter allows to retrieve some
> 8200 data. You can look for ApplePictParser::readQuicktime in
> src/lib/ApplePictParser.cxx...

Reading code from src/lib/ApplePictParser.cxx, I see:
   1494   case 0x8200: {
   1495     MWAWEmbeddedObject picture;
   1496     MWAWBox2f bdBox;
   1497     if (!readQuicktime(picture,bdBox))
   1498       return false;
...
   1506     break;
   1507   }
   1508   case 0x8201: {
...
   1512     MWAW_DEBUG_MSG(("ApplePictParser::readZone: reading compressed Quicktime is not implemented\n"));
...
   1515     break;
   1516   }


but according to https://developer.apple.com/library/archive/documentation/mac/QuickDraw/QuickDraw-461.html 8200 is for compressed code and 8201 for uncompressed mode.

I see in LO that libmwaw is still used and uses its last version.
download.lst contains:
    184 export MWAW_VERSION_MICRO := 21
    185 export MWAW_TARBALL := libmwaw-0.3.$(MWAW_VERSION_MICRO).tar.xz

What does disable pct filter in libmwaw?
I mean "ApplePictParser" is present in Library_mwaw.mk since:
commit 6b0585a5b7e32d9acb6d8bc5f15d187959c7cc5b
Author: David Tardon <dtardon@redhat.com>
Date:   Mon Aug 24 20:49:00 2015 +0200

    upload libmwaw 0.3.6

Perhaps LO ipict part could  use libmwaw which could itself use libtiff when tiff is concerned.
Now if it's the case, I don't know how to do this.
Comment 8 osnola 2022-06-12 12:48:41 UTC
>   1508   case 0x8201: {
> ...
>   1512     MWAW_DEBUG_MSG(("ApplePictParser::readZone: reading compressed Quicktime is not implemented\n"));
> ...
>   1515     break;

Most probably, a bad comment. I guess this comment was at first about opcodes 8200 and 8201, and then I found some files with opcode 8200 ( so I tried to reverse its format ).

> What does disable pct filter in libmwaw?

Oops, I was talking nonsense. I just checked that the libmwaw code for ApplePicture can be called in LibreOffice by hand selecting the Mac Legacy Drawing filter. This means that the ipict filter is called first and accepts to convert the given image ( which I will send you by mail )

> Perhaps LO ipict part could  use libmwaw which could itself use libtiff when tiff is concerned.
> Now if it's the case, I don't know how to do this.

For this picture, I suppose that it is possible to modify ipict and add a function to try to retrieve a bitmap by mimicking the code of "ApplePictParser::readQuicktime".

Note:
Apple Picture can be a mixture of bitmaps and vector graphics. ipict can call codes to work on bitmaps (for example, draw a rectangle in XOR mode, ...), so it is often better. In libmwaw, I don't have such a code, so I create only a vector graphic, (i.e. in this case, I add a rectangle and ignore the XOR mode).
Comment 9 Julien Nabet 2022-06-12 14:56:16 UTC
(In reply to osnola from comment #8)
> >   1508   case 0x8201: {
> > ...
> >   1512     MWAW_DEBUG_MSG(("ApplePictParser::readZone: reading compressed Quicktime is not implemented\n"));
> > ...
> >   1515     break;
> 
> Most probably, a bad comment. I guess this comment was at first about
> opcodes 8200 and 8201, and then I found some files with opcode 8200 ( so I
> tried to reverse its format ).
> 
> > What does disable pct filter in libmwaw?
> 
> Oops, I was talking nonsense. I just checked that the libmwaw code for
> ApplePicture can be called in LibreOffice by hand selecting the Mac Legacy
> Drawing filter. This means that the ipict filter is called first and accepts
> to convert the given image ( which I will send you by mail )
Received but it seems the same as https://bugs.documentfoundation.org/attachment.cgi?id=155279

> 
> > Perhaps LO ipict part could  use libmwaw which could itself use libtiff when tiff is concerned.
> > Now if it's the case, I don't know how to do this.
> 
> For this picture, I suppose that it is possible to modify ipict and add a
> function to try to retrieve a bitmap by mimicking the code of
> "ApplePictParser::readQuicktime".
> 
> Note:
> Apple Picture can be a mixture of bitmaps and vector graphics. ipict can
> call codes to work on bitmaps (for example, draw a rectangle in XOR mode,
> ...), so it is often better. In libmwaw, I don't have such a code, so I
> create only a vector graphic, (i.e. in this case, I add a rectangle and
> ignore the XOR mode).
Ok, I'm not good enough at dev to do this but it seems to be a good starting point for some devs.