bugGNU TeXmacs - Bugs: bug #64397, cached pdf image sizes not...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #64397: cached pdf image sizes not properly refreshed on MacOs, images get cropped

Submitter:  jadelight
Submitted:  Sun 09 Jul 2023 07:54:45 AM UTC
   
 
Category:  PDF export Priority:  5 - Normal
Item Group:  Error Status:  Ready For Test
Privacy:  Public Assigned to:  vdhoeven
Originator Name:  Open/Closed:  Open
Release:  None Release:  2.1.2
Fixed Release:  None Fixed Release: 
Keywords: 

Jump to the original submission

Sun 03 Sep 2023 07:22:51 PM UTC, comment #12: 

Hopefully, Rev #14202 should fix the issue. Can someone check on MacOs?

Philippe Joyez <pjoyez>
Group Member
Thu 31 Aug 2023 09:36:29 AM UTC, comment #11: 

I got the debug messages as follows:

(base) ➜  TeXmacs /Applications/TeXmacs.app/Contents/MacOS/TeXmacs --debug-convert

TeXmacs] debug-convert, Loading dictionary corktounicode
TeXmacs] debug-convert, Loading dictionary cork-unicode-oneway
TeXmacs] debug-convert, Loading dictionary tmuniversaltounicode
TeXmacs] debug-convert, Loading dictionary symbol-unicode-oneway
TeXmacs] debug-convert, Loading dictionary symbol-unicode-fallback
TeXmacs] debug-convert, Loading dictionary symbol-unicode-math
TeXmacs] debug-convert, Loading dictionary corktounicode
TeXmacs] debug-convert, Loading dictionary unicode-cork-oneway
TeXmacs] debug-convert, Loading dictionary tmuniversaltounicode
TeXmacs] debug-convert, Loading dictionary unicode-symbol-oneway
TeXmacs] debug-convert, Loading dictionary corktounicode
TeXmacs] debug-convert, Loading dictionary cork-unicode-oneway
TeXmacs] debug-convert, Loading dictionary tmuniversaltounicode
TeXmacs] debug-convert, Loading dictionary symbol-unicode-oneway
TeXmacs] debug-convert, Loading dictionary symbol-unicode-math
TeXmacs] With linked TrueType support
2023-08-31 17:33:21.252 TeXmacs[11824:307101] +[CATransaction synchronize] called within transaction
TeXmacs] debug-convert, image_size not cached for :/Users/yuliang/Computer/TeXmacs/pdf-image-cropped/logo.pdf
TeXmacs] debug-convert, hummus_pdf_image_info:
TeXmacs] debug-convert, image =/Users/yuliang/Computer/TeXmacs/pdf-image-cropped/logo.pdf
TeXmacs] debug-convert, crop box={0, 80.0089, 0, 80.0089}
TeXmacs] debug-convert, w,h={80, 80}
TeXmacs] debug-convert, degrees image rotated :0
TeXmacs] debug-convert, dx,dy={-0, -0}
TeXmacs] debug-convert, image_to_png ...  using gs
TeXmacs] debug-convert, gs_to_png using gs
TeXmacs] debug-convert, image_size in cache for /Users/yuliang/Computer/TeXmacs/pdf-image-cropped/logo.pdf
TeXmacs] debug-convert, 80 x 80
TeXmacs] debug-convert, w=446 h=446
TeXmacs] debug-convert, bbw=80 bbh=80
TeXmacs] debug-convert,  res =401 * 401
TeXmacs] debug-convert, "/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/bin/gs" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -g446x446 -sOutputFile=/Users/yuliang/.TeXmacs/system/tmp/11824/tmp_741378756.png -r401x401 -dUseCropBox /Users/yuliang/Computer/TeXmacs/pdf-image-cropped/logo.pdf
TeXmacs] debug-convert, answer :
2023-08-31 17:33:57.361 TeXmacs[11824:307101] +[CATransaction synchronize] called within transaction
TeXmacs] debug-convert, image_size in cache for /Users/yuliang/Computer/TeXmacs/pdf-image-cropped/logo.pdf
TeXmacs] debug-convert, 80 x 80
TeXmacs] debug-convert, image_size in cache for /Users/yuliang/Computer/TeXmacs/pdf-image-cropped/logo.pdf
TeXmacs] debug-convert, 80 x 80
TeXmacs] debug-convert, image_to_png ...  using gs
TeXmacs] debug-convert, gs_to_png using gs
TeXmacs] debug-convert, image_size in cache for /Users/yuliang/Computer/TeXmacs/pdf-image-cropped/logo.pdf
TeXmacs] debug-convert, 80 x 80
TeXmacs] debug-convert, w=446 h=446
TeXmacs] debug-convert, bbw=80 bbh=80
TeXmacs] debug-convert,  res =401 * 401
TeXmacs] debug-convert, "/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/bin/gs" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -g446x446 -sOutputFile=/Users/yuliang/.TeXmacs/system/tmp/11824/tmp_20891602.png -r401x401 -dUseCropBox /Users/yuliang/Computer/TeXmacs/pdf-image-cropped/logo.pdf
TeXmacs] debug-convert, answer :


comment #10:

> Still not reproduced on Linux.
>
> texmacs --debug-convert
>
> Then I link the image. I first have a file load dialog with preview, which triggers the creation of a png thumbnail (This probably does not occur on MacOs)
>
> TeXmacs] debug-convert, image preview :[/tmp/logo.pdf]
> TeXmacs] debug-convert, image_size not cached for :/tmp/logo.pdf
> TeXmacs] debug-convert, hummus_pdf_image_info:
> TeXmacs] debug-convert, image =/tmp/logo.pdf
> TeXmacs] debug-convert, crop box={0, 80.0089, 0, 80.0089}
> TeXmacs] debug-convert, w,h={80, 80}
> TeXmacs] debug-convert, degrees image rotated :0
> TeXmacs] debug-convert, dx,dy={-0, -0}
> TeXmacs] debug-convert, image_to_png ...  using gs
> TeXmacs] debug-convert, gs_to_png using gs
> TeXmacs] debug-convert, image_size in cache for /tmp/logo.pdf
> TeXmacs] debug-convert, 80 x 80
> TeXmacs] debug-convert, "gs" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -g98x98 -sOutputFile=/home/pj/.TeXmacs/system/tmp/146465/tmp_1135913469.png -dUseCropBox -dPDFFitPage /tmp/logo.pdf
> TeXmacs] debug-convert, answer :
>
> When I confirm the dialog, the image is actually inserted and a png is created for on-screen display:
>
> TeXmacs] debug-convert, image_size in cache for /tmp/logo.pdf
> TeXmacs] debug-convert, 80 x 80
> TeXmacs] debug-convert, qt loading image /tmp/logo.pdf
> TeXmacs] debug-convert, image_to_png ...  using gs
> TeXmacs] debug-convert, gs_to_png using gs
> TeXmacs] debug-convert, image_size in cache for /tmp/logo.pdf
> TeXmacs] debug-convert, 80 x 80
> TeXmacs] debug-convert, "gs" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -g132x132 -sOutputFile=/home/pj/.TeXmacs/system/tmp/146465/tmp_1149413475.png -dUseCropBox -dPDFFitPage /tmp/logo.pdf
> TeXmacs] debug-convert, answer :
>
> Now, I delete logo.pdf and rename logo-large.pdf to logo.pdf. Then I do Tools>Update>Pictures. This clears the size cache, all cached bitmaps and reloads all images. On the console, this gives:
>
> TeXmacs] debug-convert, image_size not cached for :/tmp/logo.pdf
> TeXmacs] debug-convert, hummus_pdf_image_info:
> TeXmacs] debug-convert, image =/tmp/logo.pdf
> TeXmacs] debug-convert, crop box={0, 241.627, 0, 247.227}
> TeXmacs] debug-convert, w,h={241, 247}
> TeXmacs] debug-convert, degrees image rotated :0
> TeXmacs] debug-convert, dx,dy={-0, -0}
> TeXmacs] debug-convert, qt loading image /tmp/logo.pdf
> TeXmacs] debug-convert, image_to_png ...  using gs
> TeXmacs] debug-convert, gs_to_png using gs
> TeXmacs] debug-convert, image_size in cache for /tmp/logo.pdf
> TeXmacs] debug-convert, 241 x 247
> TeXmacs] debug-convert, "gs" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -g132x132 -sOutputFile=/home/pj/.TeXmacs/system/tmp/146465/tmp_1720702465.png -dUseCropBox -dPDFFitPage /tmp/logo.pdf
> TeXmacs] debug-convert, answer :
>
> So the new image size is correctly determined and the new image displays correctly, with no crop.
>
> But like I said, image handling is different in MacOS... I reopen and change the Summary so as to make this apparent:
>
> Linked PDF images get cropped -> cached pdf image sizes not properly refreshed on MacOs, images get cropped

jadelight
Thu 31 Aug 2023 09:27:43 AM UTC, comment #10: 

Still not reproduced on Linux.

texmacs --debug-convert

Then I link the image. I first have a file load dialog with preview, which triggers the creation of a png thumbnail (This probably does not occur on MacOs)

TeXmacs] debug-convert, image preview :[/tmp/logo.pdf]
TeXmacs] debug-convert, image_size not cached for :/tmp/logo.pdf
TeXmacs] debug-convert, hummus_pdf_image_info:
TeXmacs] debug-convert, image =/tmp/logo.pdf
TeXmacs] debug-convert, crop box={0, 80.0089, 0, 80.0089}
TeXmacs] debug-convert, w,h={80, 80}
TeXmacs] debug-convert, degrees image rotated :0
TeXmacs] debug-convert, dx,dy={-0, -0}
TeXmacs] debug-convert, image_to_png ...  using gs
TeXmacs] debug-convert, gs_to_png using gs
TeXmacs] debug-convert, image_size in cache for /tmp/logo.pdf
TeXmacs] debug-convert, 80 x 80
TeXmacs] debug-convert, "gs" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -g98x98 -sOutputFile=/home/pj/.TeXmacs/system/tmp/146465/tmp_1135913469.png -dUseCropBox -dPDFFitPage /tmp/logo.pdf
TeXmacs] debug-convert, answer :

When I confirm the dialog, the image is actually inserted and a png is created for on-screen display:

TeXmacs] debug-convert, image_size in cache for /tmp/logo.pdf
TeXmacs] debug-convert, 80 x 80
TeXmacs] debug-convert, qt loading image /tmp/logo.pdf
TeXmacs] debug-convert, image_to_png ...  using gs
TeXmacs] debug-convert, gs_to_png using gs
TeXmacs] debug-convert, image_size in cache for /tmp/logo.pdf
TeXmacs] debug-convert, 80 x 80
TeXmacs] debug-convert, "gs" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -g132x132 -sOutputFile=/home/pj/.TeXmacs/system/tmp/146465/tmp_1149413475.png -dUseCropBox -dPDFFitPage /tmp/logo.pdf
TeXmacs] debug-convert, answer :

Now, I delete logo.pdf and rename logo-large.pdf to logo.pdf. Then I do Tools>Update>Pictures. This clears the size cache, all cached bitmaps and reloads all images. On the console, this gives:

TeXmacs] debug-convert, image_size not cached for :/tmp/logo.pdf
TeXmacs] debug-convert, hummus_pdf_image_info:
TeXmacs] debug-convert, image =/tmp/logo.pdf
TeXmacs] debug-convert, crop box={0, 241.627, 0, 247.227}
TeXmacs] debug-convert, w,h={241, 247}
TeXmacs] debug-convert, degrees image rotated :0
TeXmacs] debug-convert, dx,dy={-0, -0}
TeXmacs] debug-convert, qt loading image /tmp/logo.pdf
TeXmacs] debug-convert, image_to_png ...  using gs
TeXmacs] debug-convert, gs_to_png using gs
TeXmacs] debug-convert, image_size in cache for /tmp/logo.pdf
TeXmacs] debug-convert, 241 x 247
TeXmacs] debug-convert, "gs" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -g132x132 -sOutputFile=/home/pj/.TeXmacs/system/tmp/146465/tmp_1720702465.png -dUseCropBox -dPDFFitPage /tmp/logo.pdf
TeXmacs] debug-convert, answer :

So the new image size is correctly determined and the new image displays correctly, with no crop.

But like I said, image handling is different in MacOS... I reopen and change the Summary so as to make this apparent:

Linked PDF images get cropped -> cached pdf image sizes not properly refreshed on MacOs, images get cropped

Philippe Joyez <pjoyez>
Group Member
Wed 30 Aug 2023 04:17:24 PM UTC, comment #9: 

I attached two images of different sizes. How to reproduce the bug:

1. New document
2. Link logo.pdf
3. Remove logo.pdf and rename logo-large.pdf to logo.pdf
4. Update Pictures
5. Observe the image get cropped

I got error messages in the console, but I can't copy them. (--debug-convert in the terminal is not working).

BTW, can you reopen this bug?

comment #8:

> Right, this unexpected. However, not having access to a MacOs machine for reproducing and investigating your issue, I'd really need the full debug->convert output to retrace what goes wrong there (in order to understand how/why the cached size content was incorrectly determined). Since you suspect some interaction/confusion between images, having the tm file and all the images could be useful too.


(file #55100, file #55101)

jadelight
Tue 29 Aug 2023 09:37:46 PM UTC, comment #8: 

Right, this unexpected. However, not having access to a MacOs machine for reproducing and investigating your issue, I'd really need the full debug->convert output to retrace what goes wrong there (in order to understand how/why the cached size content was incorrectly determined). Since you suspect some interaction/confusion between images, having the tm file and all the images could be useful too.

Philippe Joyez <pjoyez>
Group Member
Sun 27 Aug 2023 03:13:49 PM UTC, comment #7: 

The bug appeared again in another document. I turned on the debug menu and activate debug->convert. The error message says something like "image size blahblah in cache 1000x300", which is wrong, because my image is 1000x400. My previous image in this Figure is 1000x300.

comment #6:

> The bug seems to have disappeared, so I close it.
>

jadelight
Mon 07 Aug 2023 09:40:58 AM UTC, comment #6: 

The bug seems to have disappeared, so I close it.

Joris van der Hoeven <vdhoeven>
Group administrator
Sun 06 Aug 2023 06:04:33 PM UTC, comment #5: 

Sorry for the late reply. Now I can't reproduce it either. But it occurs in another document previously. I also run the app in the debug mode by running the suggested commands, and I didn't see any error messages. I will investigate it further later.

comment #4:

> I cannot reproduce in Debian, either. However, this is not entirely surprising since image handling can be different on MacOS, according to the c++ code... Jadelight, can you please turn on the debug menu and activate debug->convert entry before importing the image (as an alternative, you can start texmacs with the --debug-convert command line option), and report here the corresponding debug output?

jadelight
Thu 13 Jul 2023 08:15:46 PM UTC, comment #4: 

I cannot reproduce in Debian, either. However, this is not entirely surprising since image handling can be different on MacOS, according to the c++ code... Jadelight, can you please turn on the debug menu and activate debug->convert entry before importing the image (as an alternative, you can start texmacs with the --debug-convert command line option), and report here the corresponding debug output?

Philippe Joyez <pjoyez>
Group Member
Tue 11 Jul 2023 12:38:06 PM UTC, comment #3: 

The submitter reports on the forum:
"Apple M2 Max, OS 13.4.1 (22F82). TeXmacs 2.1.2, installed from the latest build in github.
Sometimes the images are not cropped but padded with more a big white space, and the issue can get fixed by restarting TeXmacs."

I can't reproduce this on my system (Fedora Linux, TeXmacs 2.1.2). Perhaps it depends on the Qt version or platform?

Jeroen Wouters <jeronim>
Group Member
Tue 11 Jul 2023 12:36:20 PM UTC, comment #2: 

For reference, there is a related discussion about this on the forum:
http://forum.texmacs.cn/t/preview-ref-not-work-for-linked-figures/1463/14

Jeroen Wouters <jeronim>
Group Member
Sun 09 Jul 2023 07:59:08 AM UTC, comment #1: 

BTW, the pdf is created in matlab by the "exportgraphics" command. The problem occurs only if I choose 'image' as the value for the option 'ContentType'. If I choose 'vector', then the image is displayed correctly.

jadelight
Sun 09 Jul 2023 07:54:45 AM UTC, original submission:  

How to reproduce:
1. Open new document
2. Insert -> Image -> Link image
3. Select the attached image
4. Only the left lower part of the image is displayed in TeXmacs.
5. Print or export the documen to PDF. The image is displayed properly.

jadelight

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #55100:  logo.pdf added by jadelight (11KiB - application/pdf)
file #55101:  logo-large.pdf added by jadelight (31KiB - application/pdf)
file #54915:  profile1-exact.pdf added by jadelight (286KiB - application/pdf)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by vdhoeven (Updated the item)
  • -email is unavailable- added by pjoyez (Posted a comment)
  • -email is unavailable- added by jeronim (Posted a comment)
  • -email is unavailable- added by jadelight (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-09-03 pjoyez StatusNeed Info Ready For Test
    2023-08-31 pjoyez StatusFixed Need Info
        Open/ClosedClosed Open
        SummaryLinked PDF images get cropped cached pdf image sizes not properly refreshed on MacOs, images get cropped
    2023-08-30 jadelight Attached File- Added logo.pdf, #55100
        Attached File- Added logo-large.pdf, #55101
    2023-08-07 vdhoeven StatusNone Fixed
        Assigned toNone vdhoeven
        Open/ClosedOpen Closed
    2023-08-06 vdhoeven CategoryNone PDF export
    2023-07-09 jadelight Attached File- Added profile1-exact.pdf, #54915

    Back to the top

    Powered by Savane 3.13-461b.
    Corresponding source code