bugGNU TeXmacs - Bugs: bug #57193, The imported SVG/PNG images is too...

 
 

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

bug #57193: The imported SVG/PNG images is too vague

Submitter:  Darcy Shen <sadhen>
Submitted:  Fri 08 Nov 2019 03:43:29 PM UTC
   
 
Category:  Typesetter Priority:  5 - Normal
Item Group:  Error Status:  Fixed
Privacy:  Public Assigned to:  vdhoeven
Originator Name:  Open/Closed:  Closed
Release:  None Release:  1.99.11
Fixed Release:  None Fixed Release: 
Keywords: 

Jump to the original submission

Sun 19 Sep 2021 04:27:32 AM UTC, comment #10: 
Darcy Shen <sadhen>
Group Member
Sat 06 Mar 2021 03:05:33 PM UTC, comment #9: 

Since I did not get further objections to my previous assessments, I assume that the temporary solution to the problem is acceptable.  Note that the problem will disappear altogether after version 2.1, as soon as we will switch to Qt5.

Joris van der Hoeven <vdhoeven>
Group administrator
Fri 30 Oct 2020 12:07:44 PM UTC, comment #8: 

I am not sure what the status of these problems is.

1) SVG support currently relies on converters.

2) When we will switch to Qt5, SVG support will come with Qt.

3) Images should scale by default, I believe, even if this lowers their quality somewhat.  So I don't consider trhe problem from the forum as a real bug.

Joris van der Hoeven <vdhoeven>
Group administrator
Tue 28 Jan 2020 01:26:59 AM UTC, comment #7: 

Another report from the TeXmacs forum:

http://forum.texmacs.cn/t/blurry-png-pictures/116/2

Darcy Shen <sadhen>
Group Member
Sat 16 Nov 2019 05:31:21 PM UTC, comment #6: 


comment #2:

> Qt support for svg cannot be taken for granted. We only call this function if Qt declares to handle svg (see image_files.cpp). It should not fail (unless the svg itself is corrupted).
>
> Now if I remember correctly the rendering on screen of svg is horrible, but it's fine when exported in pdf. Probably we should investigate why Qt does such a bad job when converting svg to png (maybe there are some options we are not taking profit of).


I haven't figured out why svg2png by QImage is horrible.

After r12491, I add a option(Edit -> Preferences -> Convert -> Image) to prefer Inkscape for svg2png converting at r12518.

Darcy Shen <sadhen>
Group Member
Sun 10 Nov 2019 05:27:12 PM UTC, comment #5: 

r12491 skipped Qt when converting svg to png using image_to_png in image_files.cpp .

My Qt 4 (installed via https://github.com/cartr/homebrew-qt4) on macOS support svg when tested using qt_supports but failed using qt_image_size.

No, I am using GNU Linux with Qt 4, qt_supports and qt_image_size both work fine.

I will improve r12473 and r12491 the next weekend.

Darcy Shen <sadhen>
Group Member
Sun 10 Nov 2019 04:40:36 PM UTC, comment #4: 

I made an attempt to improve svg2png at r12491. But it depends on inkscape. It is just a workaround.

Darcy Shen <sadhen>
Group Member
Sat 09 Nov 2019 03:31:50 PM UTC, comment #3: 

I implemented a native image size reader for svg format at revision r12473.

Darcy Shen <sadhen>
Group Member
Fri 08 Nov 2019 11:55:09 PM UTC, comment #2: 

Qt support for svg cannot be taken for granted. We only call this function if Qt declares to handle svg (see image_files.cpp). It should not fail (unless the svg itself is corrupted).

Now if I remember correctly the rendering on screen of svg is horrible, but it's fine when exported in pdf. Probably we should investigate why Qt does such a bad job when converting svg to png (maybe there are some options we are not taking profit of).

Philippe Joyez <pjoyez>
Group Member
Fri 08 Nov 2019 05:46:07 PM UTC, comment #1: 

For SVG images under TeXmacs with Qt, we use qt_image_size to determine the size of the image.


bool
qt_image_size (url image, int& w, int& h) {// w, h in points
  if (DEBUG_CONVERT) debug_convert << "qt_image_size :" <<LF;
  QImage im= QImage (utf8_to_qstring (concretize (image)));
  if (im.isNull ()) {
      convert_error << "Cannot read image file '" << image << "'"
      << " in qt_image_size" << LF;
      w= 35; h= 35;
      return false;
  }
  else {
    w= (int) rint ((((double) im.width ())*2834)/im.dotsPerMeterX());
    h= (int) rint ((((double) im.height())*2834)/im.dotsPerMeterY());
    if (DEBUG_CONVERT) debug_convert <<"QT dotsPerMeter: "
        <<w<<" x "<<h<<LF;
    return true;
  }
}




But QImage will fail to work without Qt SVG support.

Darcy Shen <sadhen>
Group Member
Fri 08 Nov 2019 03:43:29 PM UTC, original submission:  

For PNG, it is vague in TeXmacs but it is fine when exported to PDF.

Darcy Shen <sadhen>
Group Member

 

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

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by vdhoeven (Posted a comment)
  • -email is unavailable- added by pjoyez (Posted a comment)
  • -email is unavailable- added by sadhen (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-06 vdhoeven StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-10-30 vdhoeven StatusNone Ready For Test
        Assigned toNone vdhoeven

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code