Picture within a Picture

Amateur programmer here. Problem: When I draw a picture inside a picture, the text in the original picture loses its 2D-ness. That is, if I DrawObject directly to the g. I’m fed from the canvas, 2D is fine. But if I DrawObject into a picture then draw that picture into the g. from the canvas, I get pixelated (blurry) text.

I’ve tried doing all the drawing as a 2D object as it’s fed into the picture to no avail.

Any ideas?

To further describe, I’m creating puzzle software where the top of the page is a puzzle grid, below it is a group of questions/answers which include blanks, indices under the blanks pointing to the grid, and questions I’ve formatted around those blanks. I want to save each question as a picture then simply place them on the canvas or printer g, in a loop. I’ve got it all to work just fine except when I print, the lo-res comes in.

Further clarification: when I said “Picture in Picture” I should have said “Picture in graphics object.”

You need to up the resolution of the printing from 72 to 300 or 360 dpi
Draw your graphics to the larger area, and use then what needs to be a bigger font size.

or maybe generate a PDF and get that printed: the fonts can be fully scalable.

Thanks for response.

Actually, I am producing a PDF but the problem remains. Also, I did try upping the resolution to 300 … no improvement. Not sure if I’m doing it right though.

If I can’t solve this I’ll go back to simply drawing directly to the graphics object and skip the pictures. But that brings in more issues with placement, etc. I was using an array to store the questions-as-picts and it was a beautiful thing … till I saw the printout.

If you are producing a pdf, it has a ‘notional’ dpi of 72dpi
But an effective resolution much lower, since this is floating point.
If you can render your images using vectors, you will be super sharp.
If not, generate big pictures and insert at positions gauged by ‘inch location * 72’

eg 1/2 inch from the side would be at position 36.0

The text can be inserted over the top using PDF -friendly fonts, and they will be sharp at any zoom size.

Printing is then just a question of ‘print quality’ in the print dialog.
If that is high: sharp
If it is draft: fuzzy

Good info. I have never understood why 72 dpi works out well in high res printing. Seems to just be a holdover to old CRT screens or something. Never heard of “notional” dpi. I do think I’m using vectors … at least I’m using textshapes for strings. I’ve played with the scaling and other factors and it doesn’t seem to help.

Two further points: 1) my Pictures (which are complex drawings of lines and text) when doubled in size also appear fuzzy on the screen
2) If I don’t create a Picture and just draw to the g. graphics object delivered by printer, they are fine … without any intricate detailing. So something happens when the Picture is created.

Anyway, I will continue to work on this. I may end up just drawing to g. It just limits me in other ways.

Thanks again.

Yes. What happens when you create a picture is that any possible vector information that led to its creation (like text added via DrawText, or Object2Ds) is rasterized to the resolution of the picture. Which, when created in code, usually has a resolution of 72 dpi, and for print you should target 300 dpi.

Furthermore, depending on the graphics quality settings, you might lose sharpness due to interpolation or unfitting antialiasing. One way to overcome that is to create the picture bigger than necessary and draw it with the scaling options and highest interpolation settings into the target picture. Which should be big enough in terms of resolution for the intended purpose as well.

Thanks. I’m learning a lot. One thing I wonder though is why if I just do the drawing to g. its fine.

Do not use the same object for Screen and Printing.

Do everything for Printing (@ 200 dpi) then, when needed, c reate a new Picture (“Screen Picture”) and draw the Printing Object into the “Screen Picture” (@ screen dpi).

This is only few more lines and distinct objects.

1 Like

On screen, the resolution is (usually) 72 or 96dpi
In hiDPI its double

On a printer, the resolution can be higher… eg up to 2400dpi on some machines.
In a PDF, the ‘resolution’ is 72dpi, but it is capable of rendering ‘less than a pixel’ because the co-ordinate system is floating point.
A Line of width 0.1 is perfectly valid.
When you print a PDF, if the page may be rendered to a printer using draft quality of 72 or 75dpi, these items are drawn as best they can… that 0.1 width line may well be less than the thickness of a pixel at actual 72dpi, and wouldnt appear on paper.
If the printer is running at 300 dpi, it may show up OK, or may be faint as it is blurred with surrounding white pixels.
At 1200 dpi or higher, you would see that line clearly.

So, as said above, the thing you can control is an offscreen image.
If you must draw to an image, make it 2 or 3 times the size you need.
Draw everything on that.
Then render to the screen or printer using scaling, and it should be reasonable.

1 Like

Exactly what Jeff answered. A graphics object in itself is not bound to a resolution natively. It will render its contents when told to display/print.
The general rule about aiming your output at about 300 dpi when printing is only valid for grayscale/color images. These are rasterized into dot matrices when printing and 300 dpi is about optimum for that.

Everything that uses a full color – black usually – like text, lines and similar vector elements, will not be rasterized but should result in sharp edges. For a printing press at usually around 2400 dpi resolution, the source should have at about 1200 dpi to avoid blurriness.

So when you output to a graphics object directly, everything will be rendered at best possible resolution. If you write into a picture first, rasterization is done on picture resolution level.

1 Like

That’s helpful to know. I am presently rewriting the entire printing routine to simply draw to the graphics object offered by Print. This prints nicely both to screen and to printer. But it’s complicated things and it’s a pity I couldn’t use my Picture array to do the whole page drawing.

As Curley once said high on a telephone pole looking at a sea of wires, “This is confusing.”

This is what I’m presently trying to. Thanks.