LDraw.org Discussion Forums
LPub3D: Output resolution change? - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw File Processing and Conversion (https://forums.ldraw.org/forum-22.html)
+--- Thread: LPub3D: Output resolution change? (/thread-23525.html)



LPub3D: Output resolution change? - Philippe Hurbain - 2019-07-01

Is there a way to change output resolution of LPub3D to generate the same building instructions with a low resolution for web usage, and high resolution for printing purpose?
Configuration -> Build instructions setup -> Project setup -> resolution almost does the trick but completely changes the layout because font and image sizes are changed too!


RE: LPub3D: Output resolution change? - Victor Di Rienzo - 2019-07-01

(2019-07-01, 13:12)Philippe Hurbain Wrote: Is there a way to change output resolution of LPub3D to generate the same building instructions with a low resolution for web usage, and high resolution for printing purpose?
Configuration -> Build instructions setup -> Project setup -> resolution almost does the trick but completely changes the layout because font and image sizes are changed too!
I did not find one.

What i did was export in png, then open the files on xnview and batch a proccess to lower the resolution , convey tojpg if you want, make size smaller the file, add water mark, sharp image. And many other tweaks


RE: LPub3D: Output resolution change? - Philippe Hurbain - 2019-07-01

(2019-07-01, 13:33)Victor Di Rienzo Wrote: I did not find one.

What i did was export in png, then open the files on xnview and batch a proccess to lower the resolution , convey tojpg if you want, make size smaller the file, add water mark, sharp image. And many other tweaks
Thanks Victor! I somehow expected a more direct method, but it works...


RE: LPub3D: Output resolution change? - Victor Di Rienzo - 2019-07-02

(2019-07-01, 17:56)Philippe Hurbain Wrote: Thanks Victor! I somehow expected a more direct method, but it works...

Keep in mind you can  save the procees as a template and with 3 clcks you can do all again.


Tomorrow i can show you in video conference


RE: LPub3D: Output resolution change? - Trevor Sandy - 2019-07-03

(2019-07-01, 13:12)Philippe Hurbain Wrote: Is there a way to change output resolution of LPub3D to generate the same building instructions with a low resolution for web usage, and high resolution for printing purpose?

To be sure I well understand this question, would scaling the generated instruction page(s) to a certain size satisfy your requirement for web publishing ? For example, if all your pages are of uniform size then a desired width/height setting could be specified or if your instructions are of different page sizes, then a percentage of page size would be more appropriate.

Of course, this capability would not apply to the PDF export, only png, jpg and possibly bmp exports.

Cheers,


RE: LPub3D: Output resolution change? - Philippe Hurbain - 2019-07-03

(2019-07-03, 12:38)Trevor Sandy Wrote: To be sure I well understand this question, would scaling the generated instruction page(s) to a certain size satisfy your requirement for web publishing ? For example, if all your pages are of uniform size then a desired width/height setting could be specified or if your instructions are of different page sizes, then a percentage of page size would be more appropriate.

Of course, this capability would not apply to the PDF export, only png, jpg and possibly bmp exports.
Hi Trevor,
The idea would be to be able to change the dpi setting, and get exactly the same layout but with different quality levels. For bitmap images, this would result in larger (more pixels) images as dpi is increased. For PDF, the size of page (in mm) would stay the same, but would allow to zoom in more and more as DPI is increased.
Hope I have been clear Wink


RE: LPub3D: Output resolution change? - Trevor Sandy - 2019-07-03

(2019-07-03, 12:53)Philippe Hurbain Wrote: Hi Trevor,
The idea would be to be able to change the dpi setting, and get exactly the same layout but with different quality levels. For bitmap images, this would result in larger (more pixels) images as dpi is increased. For PDF, the size of page (in mm) would stay the same, but would allow to zoom in more and more as DPI is increased.
Hope I have been clear Wink

Understood. This change is somewhat trivial with only a conversion from inches to metres required for the image generation (jpg, png, bmp). For PDF, there is a method to consume directly the specified dpi.


Cheers,


RE: LPub3D: Output resolution change? - Philippe Hurbain - 2019-07-03

To make it clear: I have prepared 3 files, the first at 150dpi, the second 300dpi (without changing anything else), the third at 300dpi, with font setup changed so that layout matches the page layout at 150dpi. Actually "all" I had to do was to double the font size for each elements.

BTW, this made me find a little bug: when you try to change the font used by default on some element, the initial font size is properly reflected in dialog box, but not the font style (normal/bold/italic).


RE: LPub3D: Output resolution change? - Trevor Sandy - 2019-07-03

(2019-07-03, 14:26)Philippe Hurbain Wrote: To make it clear: I have prepared 3 files, the first at 150dpi, the second 300dpi (without changing anything else), the third at 300dpi, with font setup changed so that layout matches the page layout at 150dpi. Actually "all" I had to do was to double the font size for each elements.

BTW, this made me find a little bug: when you try to change the font used by default on some element, the initial font size is properly reflected in dialog box, but not the font style (normal/bold/italic).

Excellent. Do you mind sharing the model file used to generate these controls ?


Quote:BTW, this made me find a little bug: when you try to change the font used by default on some element, the initial font size is properly reflected in dialog box, but not the font style (normal/bold/italic).


Thanks for reporting this behaviour. I'll take a look.

Cheers,


RE: LPub3D: Output resolution change? - Philippe Hurbain - 2019-07-03

(2019-07-03, 16:18)Trevor Sandy Wrote: Excellent. Do you mind sharing the model file used to generate these controls ?
Here they are (I didn't save the files so I recreated - and simplified - them)


RE: LPub3D: Output resolution change? - Trevor Sandy - 2019-07-03

(2019-07-03, 17:05)Philippe Hurbain Wrote: Here they are (I didn't save the files so I recreated - and simplified - them)

Excellent - thank you.

Cheers,


RE: LPub3D: Output resolution change? - Trevor Sandy - 2019-07-06

I've added the capability to edit the pixel ratio for exports. Consequently, one can set the ratio less than 1 to reduce the rendered DPI or greater than 1 to increase it. As you specified, PNG, JPG and BMP exports will increase in both file size and image size accordingly while PDF exports will only increase in file size. You can see full details at the LPub3D GitHub ticket #304.


.png   LPub3D_Pixel_Ratio.png (Size: 13.28 KB / Downloads: 34)

Cheers,


RE: LPub3D: Output resolution change? - Philippe Hurbain - 2019-07-06

(2019-07-06, 6:32)Trevor Sandy Wrote: I've added the capability to edit the pixel ratio for exports. Consequently, one can set the ratio less than 1 to reduce the rendered DPI or greater than 1 to increase it. As you specified, PNG, JPG and BMP exports will increase in both file size and image size accordingly while PDF exports will only increase in file size. You can see full details at the LPub3D GitHub ticket #304.
Cheers,
Thanks Trevor, I'll try this ASAP!


RE: LPub3D: Output resolution change? - Victor Di Rienzo - 2019-07-06

(2019-07-06, 6:32)Trevor Sandy Wrote: I've added the capability to edit the pixel ratio for exports. Consequently, one can set the ratio less than 1 to reduce the rendered DPI or greater than 1 to increase it. As you specified, PNG, JPG and BMP exports will increase in both file size and image size accordingly while PDF exports will only increase in file size. You can see full details at the LPub3D GitHub ticket #304.



Cheers,
Other option you can add to the pdf export is to merge all the objects of the page i to 1 image.

Let me explain. When you export the pdf you can open it with coreldraw or adobe ilustratir or any of those software and the model is 1 image, the pli is other and the background is other.

The idea is to be able to merge all of them as its done when you export a png file so. The final pdf cant be edited.


RE: LPub3D: Output resolution change? - Johann Eisner - 2019-07-06

I export my building instructions always first as .png files to possibly additional hints etc. to insert.  Only when all images are consistent the PDF is created.


RE: LPub3D: Output resolution change? - Travis Cobbs - 2019-07-06

(2019-07-06, 6:32)Trevor Sandy Wrote: I've added the capability to edit the pixel ratio for exports. Consequently, one can set the ratio less than 1 to reduce the rendered DPI or greater than 1 to increase it. As you specified, PNG, JPG and BMP exports will increase in both file size and image size accordingly while PDF exports will only increase in file size. You can see full details at the LPub3D GitHub ticket #304.

It's not too important, but both PNG and JPEG support indicating the pixel density of an image. The PNG format has horizontal and vertical PPM (pixels per meter) settings, and the JPEG EXIF format has XResolution, YResolution, and ResolutionUnit settings. (ResolutionUnit is treated as an enum, with one value being inches, and the other being centimeters.) These allow you to indicate the horizontal and vertical "resolution" of the image. (In this case, "resolution" refers to the number of pixels per unit of length, not the total number of pixels.)

These values are ignored by most software, but there are exceptions. For example, macOS considers any image set to 144 PPI (5669 PPM) to be a "retina" image, and automatically scales it down by 50% by default in Preview. On a Retina display, this causes the image to show up pixel-perfect. On a non-Retina display, it still scales down by 50%, but of course that means that it has to be down-sampled. Also, programs like Photoshop pay attention to the number to calculate a default size when printing.


RE: LPub3D: Output resolution change? - Trevor Sandy - 2019-07-06

(2019-07-06, 15:28)Victor Di Rienzo Wrote: Other option you can add to the pdf export is to merge all the objects of the page i to 1 image.

Let me explain. When you export the pdf you can open it with coreldraw or adobe illustrator or any of those software and the model is 1 image, the pli is other and the background is other.

The idea is to be able to merge all of them as its done when you export a png file so. The final pdf cant be edited.

A collateral behaviour of GitHub ticket #304 is exactly the behaviour you have described. The reason for this is that in order to manipulate the pixel density of the PDF document, I first create an image object of each page at the specified export DPI and then write that object to the pdfWriter. This is a change from the behaviour before #304 where I directly rendered the scene to the pdfWriter so the scene's objects were individually painted. You can enable this behaviour by checking the "Use Page Image" box shown below. This setting is preserved after the dialogue is closed.


.png   LPub3D_Pixel_Ratio_Tooltip.png (Size: 16.62 KB / Downloads: 34)

Here is a graphic comparing a default exported pdf page with a single page image exported page.

   


Cheers,


RE: LPub3D: Output resolution change? - Travis Cobbs - 2019-07-06

I forgot to mention, but PCs and Macs can fight over these settings. On a Mac, one non-Retina "pixel" is treated as a "point", which means 1/72nd of an inch. So, even though non-Retina displays are usually around 100 PPI, and Retina displays are around 200 PPI (on Macs), the Mac treats them as if they are 72 PPI and 144 PPI respectively. On Windows, I think that the default assumption is that the display is 100 PPI. So if software does pay attention to the setting for on-screen rendering, you'll get different results on a Mac vs. a PC. Having said that, hardly any software pays attention to this setting for on-screen rendering. Because of that, using 72ppi as the setting for a 1x scale factor will usually be your best bet.


RE: LPub3D: Output resolution change? - Trevor Sandy - 2019-07-06

(2019-07-06, 19:57)Travis Cobbs Wrote: I forgot to mention, but PCs and Macs can fight over these settings. On a Mac, one non-Retina "pixel" is treated as a "point", which means 1/72nd of an inch. So, even though non-Retina displays are usually around 100 PPI, and Retina displays are around 200 PPI (on Macs), the Mac treats them as if they are 72 PPI and 144 PPI respectively. On Windows, I think that the default assumption is that the display is 100 PPI. So if software does pay attention to the setting for on-screen rendering, you'll get different results on a Mac vs. a PC. Having said that, hardly any software pays attention to this setting for on-screen rendering. Because of that, using 72ppi as the setting for a 1x scale factor will usually be your best bet.

LPub3D sets the default rendered PPI/DPI at 150px. Of course this can be changed by the user.


RE: LPub3D: Output resolution change? - Jaco van der Molen - 2019-07-08

(2019-07-06, 15:28)Victor Di Rienzo Wrote: Other option you can add to the pdf export is to merge all the objects of the page i to 1 image.

Let me explain. When you export the pdf you can open it with coreldraw or adobe ilustratir or any of those software and the model is 1 image, the pli is other and the background is other.

The idea is to be able to merge all of them as its done when you export a png file so. The final pdf cant be edited.

Interesting discussion I am just reading and following now.

I certainly would like to keep the PDF out as it is, so that you can edit the individual elements.

So please make this optional?


RE: LPub3D: Output resolution change? - Jaco van der Molen - 2019-07-08

(2019-07-06, 6:32)Trevor Sandy Wrote: I've added the capability to edit the pixel ratio for exports. Consequently, one can set the ratio less than 1 to reduce the rendered DPI or greater than 1 to increase it. As you specified, PNG, JPG and BMP exports will increase in both file size and image size accordingly while PDF exports will only increase in file size. You can see full details at the LPub3D GitHub ticket #304.

This is a great addition!
The solution to the problem Philo describes is a long wanted wish.
However, I cannot recall if I ever asked for it, I sure welcome it now!


RE: LPub3D: Output resolution change? - Trevor Sandy - 2019-07-21

(2019-07-08, 12:37)Jaco van der Molen Wrote: Interesting discussion I am just reading and following now.

I certainly would like to keep the PDF out as it is, so that you can edit the individual elements.

So please make this optional?

I've restored the original export behaviour (individual elements) and added an option to export a single image for each pdf page. This post and GitHub ticket #304 have been updated accordingly.

Cheers,