Bug 70616 - FILESAVE: docx: JPG images not saved on export
Summary: FILESAVE: docx: JPG images not saved on export
Status: RESOLVED DUPLICATE of bug 52226
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.0.alpha0+ Master
Hardware: Other All
: medium normal
Assignee: Jacobo Aragunde Pérez
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-18 12:26 UTC by Jacobo Aragunde Pérez
Modified: 2013-12-31 12:03 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Test case (16.38 KB, application/vnd.oasis.opendocument.text)
2013-10-18 12:26 UTC, Jacobo Aragunde Pérez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jacobo Aragunde Pérez 2013-10-18 12:26:01 UTC
Created attachment 87822 [details]
Test case

The attached file contains a JPG image embedded into a document as a Draw object. When you export this document to docx the image itself is not saved: if you unzip the docx file you will see that /word/media/ contains a 0-byte file called "image1".


Why is this happening? Look at the code that should save the image file:

oox/source/export/vmlexport.cxx:559

if ( rProps.GetOpt( ESCHER_Prop_fillBlip, aStruct ) && m_pTextExport)
{
    SvMemoryStream aStream;
    int nHeaderSize = 25; // The first bytes are WW8-specific, we're only interested in the PNG
    aStream.Write(aStruct.pBuf + nHeaderSize, aStruct.nPropSize - nHeaderSize);
    aStream.Seek(0);
    Graphic aGraphic;
    GraphicConverter::Import(aStream, aGraphic, CVT_PNG);
    OUString aImageId = m_pTextExport->GetDrawingML().WriteImage( aGraphic );
    pAttrList->add(FSNS(XML_r, XML_id), OUStringToOString(aImageId, RTL_TEXTENCODING_UTF8));
}

As you can see, CVT_PNG is hard-wired here.

If you had used a PNG image it would have been properly saved but the image wouldn't appear when you open back that saved .docx that's a different bug anyway ;) (probably #65836).
Comment 1 Jacobo Aragunde Pérez 2013-10-29 16:40:31 UTC
This change addresses this issue among others: https://gerrit.libreoffice.org/6369
Comment 2 tommy27 2013-12-31 12:03:03 UTC
I think this issue is a duplicate of Bug 52226.
I Hope you comments about saving code could help the devs.

*** This bug has been marked as a duplicate of bug 52226 ***