Skip to main content
Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare).
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134
<svg height="345.6pt" version="1.1" viewBox="0 0 460.8 345.6" width="460.8pt"
<svg height="345.6pt" version="1.1" viewBox="0 0 460.8 345.6" width="460.8pt"
<svg height="345.6pt" version="1.1" viewBox="0 0 460.8 345.6" width="460.8pt"
<svg height="345.6pt" version="1.1" viewBox="0 0 460.8 345.6" width="460.8pt"
Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare) - the syntax highlighting is almost completely broken for command lines.
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134
./base.py
identify base.png
./base.py
identify base.png
fig.dpi = 100.0
fig.get_size_inches() = [6.4 4.8]
base.png PNG 640x480 640x480+0+0 8-bit sRGB 13064B 0.000u 0:00.000
fig.dpi = 100.0
fig.get_size_inches() = [6.4 4.8]
base.png PNG 640x480 640x480+0+0 8-bit sRGB 13064B 0.000u 0:00.000
./get_size.py 431
./get_size.py 431
get_size.png PNG 574x431 574x431+0+0 8-bit sRGB 10058B 0.000u 0:00.000
get_size.png PNG 574x431 574x431+0+0 8-bit sRGB 10058B 0.000u 0:00.000
./get_size.py 1293
./get_size.py 1293
main.png PNG 1724x1293 1724x1293+0+0 8-bit sRGB 46709B 0.000u 0:00.000
main.png PNG 1724x1293 1724x1293+0+0 8-bit sRGB 46709B 0.000u 0:00.000
./width.py 431 869
./width.py 431 869
width.png PNG 869x431 869x431+0+0 8-bit sRGB 10965B 0.000u 0:00.000
width.png PNG 869x431 869x431+0+0 8-bit sRGB 10965B 0.000u 0:00.000
./width.py 431 869
./width.py 431 869
width.png PNG 211x431 211x431+0+0 8-bit sRGB 6949B 0.000u 0:00.000
width.png PNG 211x431 211x431+0+0 8-bit sRGB 6949B 0.000u 0:00.000
width.png PNG 211x431 211x431+0+0 8-bit sRGB 7134B 0.000u 0:00.000
width.png PNG 211x431 211x431+0+0 8-bit sRGB 7134B 0.000u 0:00.000
./magic.py 431 231
./magic.py 431 231
magic.png PNG 431x231 431x231+0+0 8-bit sRGB 7923B 0.000u 0:00.000
magic.png PNG 431x231 431x231+0+0 8-bit sRGB 7923B 0.000u 0:00.000
./magic.py 1291 693
./magic.py 1291 693
magic.png PNG 1291x693 1291x693+0+0 8-bit sRGB 25013B 0.000u 0:00.000
magic.png PNG 1291x693 1291x693+0+0 8-bit sRGB 25013B 0.000u 0:00.000
./set_size_inches.py 431 231
./set_size_inches.py 431 231
set_size_inches.png PNG 430x231 430x231+0+0 8-bit sRGB 8078B 0.000u 0:00.000
set_size_inches.png PNG 430x231 430x231+0+0 8-bit sRGB 8078B 0.000u 0:00.000
./set_size_inches.py 1291 693
./set_size_inches.py 1291 693
set_size_inches.png PNG 1291x693 1291x693+0+0 8-bit sRGB 19798B 0.000u 0:00.000
set_size_inches.png PNG 1291x693 1291x693+0+0 8-bit sRGB 19798B 0.000u 0:00.000
./get_size_svg.py 431
./get_size_svg.py 431
get_size_svg.svg SVG 614x461 614x461+0+0 8-bit sRGB 17094B 0.000u 0:00.000
get_size_svg.svg SVG 614x461 614x461+0+0 8-bit sRGB 17094B 0.000u 0:00.000
inkscape -h 431 get_size_svg.svg -b FFF -e get_size_svg.png
inkscape -h 431 get_size_svg.svg -b FFF -e get_size_svg.png
./base.py
identify base.png
fig.dpi = 100.0
fig.get_size_inches() = [6.4 4.8]
base.png PNG 640x480 640x480+0+0 8-bit sRGB 13064B 0.000u 0:00.000
./get_size.py 431
get_size.png PNG 574x431 574x431+0+0 8-bit sRGB 10058B 0.000u 0:00.000
./get_size.py 1293
main.png PNG 1724x1293 1724x1293+0+0 8-bit sRGB 46709B 0.000u 0:00.000
./width.py 431 869
width.png PNG 869x431 869x431+0+0 8-bit sRGB 10965B 0.000u 0:00.000
./width.py 431 869
width.png PNG 211x431 211x431+0+0 8-bit sRGB 6949B 0.000u 0:00.000
width.png PNG 211x431 211x431+0+0 8-bit sRGB 7134B 0.000u 0:00.000
./magic.py 431 231
magic.png PNG 431x231 431x231+0+0 8-bit sRGB 7923B 0.000u 0:00.000
./magic.py 1291 693
magic.png PNG 1291x693 1291x693+0+0 8-bit sRGB 25013B 0.000u 0:00.000
./set_size_inches.py 431 231
set_size_inches.png PNG 430x231 430x231+0+0 8-bit sRGB 8078B 0.000u 0:00.000
./set_size_inches.py 1291 693
set_size_inches.png PNG 1291x693 1291x693+0+0 8-bit sRGB 19798B 0.000u 0:00.000
./get_size_svg.py 431
get_size_svg.svg SVG 614x461 614x461+0+0 8-bit sRGB 17094B 0.000u 0:00.000
inkscape -h 431 get_size_svg.svg -b FFF -e get_size_svg.png
./base.py
identify base.png
fig.dpi = 100.0
fig.get_size_inches() = [6.4 4.8]
base.png PNG 640x480 640x480+0+0 8-bit sRGB 13064B 0.000u 0:00.000
./get_size.py 431
get_size.png PNG 574x431 574x431+0+0 8-bit sRGB 10058B 0.000u 0:00.000
./get_size.py 1293
main.png PNG 1724x1293 1724x1293+0+0 8-bit sRGB 46709B 0.000u 0:00.000
./width.py 431 869
width.png PNG 869x431 869x431+0+0 8-bit sRGB 10965B 0.000u 0:00.000
./width.py 431 869
width.png PNG 211x431 211x431+0+0 8-bit sRGB 6949B 0.000u 0:00.000
width.png PNG 211x431 211x431+0+0 8-bit sRGB 7134B 0.000u 0:00.000
./magic.py 431 231
magic.png PNG 431x231 431x231+0+0 8-bit sRGB 7923B 0.000u 0:00.000
./magic.py 1291 693
magic.png PNG 1291x693 1291x693+0+0 8-bit sRGB 25013B 0.000u 0:00.000
./set_size_inches.py 431 231
set_size_inches.png PNG 430x231 430x231+0+0 8-bit sRGB 8078B 0.000u 0:00.000
./set_size_inches.py 1291 693
set_size_inches.png PNG 1291x693 1291x693+0+0 8-bit sRGB 19798B 0.000u 0:00.000
./get_size_svg.py 431
get_size_svg.svg SVG 614x461 614x461+0+0 8-bit sRGB 17094B 0.000u 0:00.000
inkscape -h 431 get_size_svg.svg -b FFF -e get_size_svg.png
Active reading [<https://en.wikipedia.org/wiki/ImageMagick> <https://en.wikipedia.org/wiki/Sentence_clause_structure#Run-on_sentences> (see also <https://twitter.com/PeterMortensen/status/1199839973215739907>)].
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134

Summary of current status: things are messy, and I am not sure if it is a fundamental limitation, or if the use case just didn't get enough attention from devs,developers. I couldn't easily find an upstream discussion about this.

base.py

base.py

runRun:

outputsOutputs:

enter image description hereEnter image description here

get_size.py

get_size.py

runRun:

outputsOutputs:

enter image description hereEnter image description here

outputsOutputs:

enter image description hereEnter image description here

enter image description hereEnter image description here

width.py

width.py

runRun:

outputOutput:

enter image description hereEnter image description here

outputOutput:

enter image description hereEnter image description here

enter image description hereEnter image description here

magic.py

magic.py

runRun:

outputsOutputs:

enter image description hereEnter image description here

outputsOutputs:

enter image description hereEnter image description here

set_size_inches.py

set_size_inches.py

runRun:

outputsOutputs:

soSo the height is slightly off, and the image:

enter image description hereEnter image description here

outputsOutputs:

enter image description hereEnter image description here

I could not find how to set it for SVG images, my approaches only worked for PNG, e.g.:

get_size_svg.py

get_size_svg.py

runRun:

andAnd the generated output contains:

andAnd identify says:

andAnd if I open it in Chromium 86 the browser debug tools mouse image hover confirm that height as 460.79.

enter image description hereEnter image description here

I use InkscapeInkscape instead of Imagemagick'sImageMagick's convert here because you need to mess with -density as well to get sharp SVG resizes with ImageMagick:

TestedIt was tested on matplotlib==3matplotlib 3.2.2.

Summary of current status: things are messy, not sure if it is a fundamental limitation, or if the use case just didn't get enough attention from devs, I couldn't easily find an upstream discussion about this.

base.py

run:

outputs:

enter image description here

get_size.py

run:

outputs:

enter image description here

outputs:

enter image description here

enter image description here

width.py

run:

output:

enter image description here

output:

enter image description here

enter image description here

magic.py

run:

outputs:

enter image description here

outputs:

enter image description here

set_size_inches.py

run:

outputs:

so the height is slightly off, and the image:

enter image description here

outputs:

enter image description here

I could not find how to set it for SVG images, my approaches only worked for PNG e.g.:

get_size_svg.py

run:

and the generated output contains:

and identify says:

and if I open it in Chromium 86 the browser debug tools mouse image hover confirm that height as 460.79.

enter image description here

I use Inkscape instead of Imagemagick's convert here because you need to mess with -density as well to get sharp SVG resizes with ImageMagick:

Tested on matplotlib==3.2.2.

Summary of current status: things are messy, and I am not sure if it is a fundamental limitation, or if the use case just didn't get enough attention from developers. I couldn't easily find an upstream discussion about this.

base.py

Run:

Outputs:

Enter image description here

get_size.py

Run:

Outputs:

Enter image description here

Outputs:

Enter image description here

Enter image description here

width.py

Run:

Output:

Enter image description here

Output:

Enter image description here

Enter image description here

magic.py

Run:

Outputs:

Enter image description here

Outputs:

Enter image description here

set_size_inches.py

Run:

Outputs:

So the height is slightly off, and the image:

Enter image description here

Outputs:

Enter image description here

I could not find how to set it for SVG images, my approaches only worked for PNG, e.g.:

get_size_svg.py

Run:

And the generated output contains:

And identify says:

And if I open it in Chromium 86 the browser debug tools mouse image hover confirm that height as 460.79.

Enter image description here

I use Inkscape instead of ImageMagick's convert here because you need to mess with -density as well to get sharp SVG resizes with ImageMagick:

It was tested on matplotlib 3.2.2.

added 229 characters in body
Source Link
Ciro Santilli OurBigBook.com
  • 395.2k
  • 122
  • 1.4k
  • 1.1k
Loading
added 48 characters in body
Source Link
Ciro Santilli OurBigBook.com
  • 395.2k
  • 122
  • 1.4k
  • 1.1k
Loading
Rollback to Revision 3
Source Link
Ciro Santilli OurBigBook.com
  • 395.2k
  • 122
  • 1.4k
  • 1.1k
Loading
Active reading [<https://en.wikipedia.org/wiki/ImageMagick> <https://en.wikipedia.org/wiki/Matplotlib>].
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134
Loading
added 213 characters in body
Source Link
Ciro Santilli OurBigBook.com
  • 395.2k
  • 122
  • 1.4k
  • 1.1k
Loading
added 1527 characters in body
Source Link
Ciro Santilli OurBigBook.com
  • 395.2k
  • 122
  • 1.4k
  • 1.1k
Loading
Source Link
Ciro Santilli OurBigBook.com
  • 395.2k
  • 122
  • 1.4k
  • 1.1k
Loading