public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: "jmuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<jmuccigr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: tiff sizing problems in md to docx
Date: Wed, 23 Jun 2021 10:27:06 -0700	[thread overview]
Message-ID: <m21r8so5jp.fsf@MacBook-Pro-2.hsd1.ca.comcast.net> (raw)
In-Reply-To: <ad6c9227-764d-4a81-9242-efdbbef46916n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


Why don't you submit an issue to the tracker?
I note that Text.Pandoc.ImageSize doesn't contain a type for
Tiff, and also that the default for imagesize has a 1.5 aspect
ratio...so my guess is that we're just using defaults there.

I think it will be a trivial fix to support tiff properly!

"jmuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <jmuccigr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Any help on this one?
>
> Thanks.
>
> On Saturday, 12 June 2021 at 15:34:25 UTC-4 jmuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>
>> In working on a document with tiff images in it, I ran into some trouble. 
>> Basically the proportions of the tiff get changed in the output docx file. 
>> (Caveat: I don't have Word on my computer, but the macOS quicklook, Pages, 
>> LibreOffice, Google doc conversation, and some random on-line file 
>> converter all show the problem, so I take it that it's real.) I attach one 
>> of the problematic docx files.
>>
>> It showed up for me like this:
>>
>> An included tiff image had the wrong proportions in the output docx. The 
>> width was scaled down, so the image looked horizontally squished. I attach 
>> a screen shot where the first image is a jpeg version and the second a 
>> tiff. In that image, the jpeg has the dimensions of 1050x476, for a ratio 
>> of 2.20, which matches the original. The tiff is 750x500 for a ratio of 
>> 1.50 and the pixel height isn't the same as the jpeg either, so that's 
>> getting changed, too.
>>
>> If I look at the document.xml in the unzipped version of the 
>> pandoc-generated docx, I see this, which provides a 1.5 ratio of cx to cy:
>>
>> ```
>> <a:xfrm>
>>     <a:off x="0" y="0"/>
>>     <a:ext cx="3810000" cy="2540000"/>
>> </a:xfrm>
>> ```
>>
>> If I use image magic's format command, the original tiff has the following 
>> relevant (I think) properties:
>>
>> -  Geometry: 1758x798+0+0
>> -  Resolution: 300x300
>> -  Print size: 5.86x2.66
>> -  Units: PixelsPerInch
>>
>> I don't see anything else that gets me to that 1.5 ratio. Note that both 
>> image files in the unzipped docx seem identical to the originals, so 
>> nothing is going on there.
>>
>> 2. In doing some testing, I came across a similar problem. I used 
>> imagemagick to create two identical images, one jpeg and the other tiff. 
>> Then I put them into a docx via pandoc:
>>
>> ```
>> > magick rose: -format jpeg -resize 600% -colorspace gray -units 
>> pixelsperinch -density 300 rose.jpeg
>> > magick rose: -format tiff -resize 600% -colorspace gray -units 
>> pixelsperinch -density 300 rose.tiff
>> > pandoc -t docx -o rose.docx
>> Hello.
>>
>> ![jpeg](./rose.jpeg)
>>
>> Goodbye
>>
>> ![tiff](rose.tiff)
>>
>> ```
>> In this case the output images are very obviously differently sized, and 
>> the second once again has an aspect ratio of 1.5 (the original is 1.52, so 
>> the two images look identically proportioned to the eye). It also has the 
>> identical pixel size as the tiff in the other example. I attach this file.
>>
>> If I output to odt, I get the following warning and the output file again 
>> has a wrongly ratio'd tiff (not shown, but it's square):
>>
>> `[WARNING] Could not determine image size for rose.tiff: could not 
>> determine image type`
>>
>> So something appears to be going on with reading tiffs.
>>
>> [image: Screen Shot 2021-06-12 at 14.33.55.png]
>> [image: Screen Shot 2021-06-12 at 14.44.57.png]
>>
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ad6c9227-764d-4a81-9242-efdbbef46916n%40googlegroups.com.


  parent reply	other threads:[~2021-06-23 17:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <131ae7e2-cb6a-47a0-a2b6-c724cfba584an@googlegroups.com>
     [not found] ` <131ae7e2-cb6a-47a0-a2b6-c724cfba584an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-06-23 16:03   ` jmuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
     [not found]     ` <ad6c9227-764d-4a81-9242-efdbbef46916n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-06-23 17:27       ` John MacFarlane [this message]
     [not found]         ` <m21r8so5jp.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-06-23 17:49           ` jmuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2021-07-29  8:42   ` jmuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21r8so5jp.fsf@MacBook-Pro-2.hsd1.ca.comcast.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=jmuccigr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).