Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97e6b34

Browse files
committed
Fix PNG resolution metadata.
svn path=/trunk/matplotlib/; revision=8298
1 parent c604604 commit 97e6b34

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/_png.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Py::Object _png_module::write_png(const Py::Tuple& args)
140140
// Save the dpi of the image in the file
141141
if (args.size() == 5) {
142142
double dpi = Py::Float(args[4]);
143-
size_t dots_per_meter = (size_t)(dpi / (2.54 / 100.0));
143+
size_t dots_per_meter = (size_t)(dpi * 2.54 * 100.0);
144144
png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, PNG_RESOLUTION_METER);
145145
}
146146

0 commit comments

Comments
 (0)