https://bugs.freedesktop.org/show_bug.cgi?id=83073

          Priority: medium
            Bug ID: 83073
          Assignee: [email protected]
           Summary: Images pasted / opened from HTML at incorrect size
          Severity: normal
    Classification: Unclassified
                OS: Windows (All)
          Reporter: [email protected]
          Hardware: x86 (IA32)
            Status: UNCONFIRMED
           Version: 4.3.0.4 release
         Component: Writer
           Product: LibreOffice

Copying images from a web page and pasting into a LibreOffice HTML Document,
the pasted images are not always at the correct size. In some cases, they are
only 2cm x 1cm; this appears to be the size of the initial placeholder, which
is then replaced with the image content and usually resized to suit, but in
some cases the resize does not seem to occur. Format > Image > Type > Original
Size sets the images to too large a size, and saving from LibreOffice as HTML
leads to pixel sizes larger than the original image.

Steps to reproduce:

In LibreOffice:
1) Create a new HTML Document (File > New > HTML Document).

In a web browser:
2) Open the attached HTML document (html-img-size-demo.html). This contains two
images, one using a data: URI to embed image data in the HTML file, the other
using a http: URI to download the same image from xkcd.com; both are 727 x 233
pixels.

3) Copy the first (data: URI) image (right-click > Copy Image or similar
depending on browser).

In LibreOffice:
4) Paste into the HTML document. The image is pasted at 2.00 x 1.00 cm. Saving
the document leads to an <img> tag with width="75" height="38" (pixels).

5) Select the image and go to Format > Image > Type > Original Size. The image
size is set to 25.64 x 8.22 cm. Saving the document leads to an <img> tag with
width="969" height="311" (pixels); this is not the original image size.

In a web browser:
6) Copy the second (http: URI) image (right-click > Copy Image or similar
depending on browser).

In LibreOffice:
7) Paste into the HTML document. A 2.00 x 1.00 cm placeholder initially
appears, but it changes to 19.24 x 6.16 cm once the image is downloaded. Saving
the document leads to an <img> tag with width="727" height="233" (pixels); this
is the correct original image size.

8) Select the image and go to Format > Image > Type > Original Size. The image
size is set to 25.64 x 8.22 cm, and saving the document leads to an <img> tag
with width="969" height="311" (pixels); this is not the original image size.

9) Close the HTML document.

10) Open the attached HTML document (html-img-size-demo.html) in LibreOffice.
Both images are 2.00 x 1.00 cm. Saving the document leads to <img> tags with
width="75" height="38" (pixels).

11) For each image in turn, select the image and go to Format > Image > Type >
Original Size. Both image sizes are set to 25.64 x 8.22 cm, and saving the
document leads to <img> tags with width="969" height="311" (pixels); this is
not the original image size.


The same behaviour is observed using LibreOffice Writer with a text document.
In that case, it is necessary to ensure the page size is large enough (e.g. set
to A3 landscape) to avoid capping the size, and also need to use Paste Special
> HTML format since the default is to paste as bitmap.


Expected behaviour:
- Pasted images (and those from opening the HTML file) should be the size of
the source image.
- Format > Image > Type > Original Size should set the image size to that of
the source image.
- Saving the resulting LibreOffice HTML document should lead to pixel
dimensions matching the original image.


There are possibly a couple of different issues here:
1. The initial 2.00 x 1.00 cm placeholder is not always resized after loading
the image.
2. It appears that a scale of 72 pixels/inch is used when determining the
"original image size", but a scale of 96 pixels/inch is used when determining
the pixel size for the <img> tag on saving the HTML document.


Tested using:
- Windows Vista, 32-bit
- LibreOffice 4.3.0.4
- Copying from multiple web browsers:
  - Mozilla SeaMonkey 2.26.1
  - Internet Explorer 9.0.8112.16421
  - Google Chrome 36.0.1985.143

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to