Graphic formats and quality (only for experts)

Posted on 2002-07-22
Last Modified: 2010-05-02
I am using a .jpg file and a .bmp file in two different picture boxes. I am printing the pictures using the printer object in visual basic (through paintpicture property). I want to know is there any different in quality between the two file formats.

i.e. how does VB represet the graphic file to the printer.Does VB recognizes the difference between the two format I used in picture boxes and sends it as separate information to the printer.

Please give me more details about how to control the priter object more accurately to find the difference between the two printers. Or is there any advance method in VB like using API to send the graphic file to the printer.
Question by:tppradeep18
LVL 22

Expert Comment

ID: 7169996
The only difference between a .bmp and a .jpg is that they are stored in different formats.  Once loaded into VB, they are no longer .bmps or .jpgs; they are picture objects.

When you print, you are printing a picture object not a bmp or a jpg.  This is also one reason why when you save a picture it always puts it in .bmp format.

When you resize the container which has the picture, VB goes back to the picture object and uses that to display more of the picture if necessary.

If the picture is in an image control, and the Stretch property is true, the picture is retained in its picture object, and the picture is displayed stretched through a separate calculation.  If restretched, it again goes to the picture object to calculate how to resize the image.

LVL 18

Expert Comment

ID: 7172517
So, as rspahitz is saying, once the picture is in the picturebox, it makes no difference what the initial format was.  However, the initial format of the picture may have caused a loss of quality before it was even loaded into VB.

So, if you had a high resolution scanned image and you converted it into a 24-bit bmp and also into a mid to low quality jpg, the jpg would be a substantially smaller file, because of the jpg compression performed.  This compression can lose a significant amount of graphic data, such that if you were to load two VB picture boxes, one from the saved 24-bit bmp and one from the saved jpg, the picturebox with the jpg image loaded into it would not have a high quality image as the one loaded from the .bmp, and would print with lower quality.

Author Comment

ID: 7173455
both of you have given nice information. thanks for that. I want to know whey both images look similar on the screen and once printed look very different. Also want to know, to print the graphics is there any other method other than using printer object. I am really concerned about the quality again. if you guys know any activex control that can print TIFF image please do let me know. I suppose TIFF images have higher quality.
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

LVL 22

Accepted Solution

rspahitz earned 60 total points
ID: 7174822
Actually, similar questions to this have come up several times.  The answer always seems to lead to one thing:  VB prints the picture that is has in memory; Photoshop and other tools seem to manipulate the picture to try to optimize it for the printer.  This interpolation process usually does a good job of making a picture appear nicer than it really is.

In VB, if you load a picture, full-size, into a picturebox, then print it to a printer, full-size, you will get an exact printout of the picture.  The only problem is that what you see on the screen may not really be the actual picture because VB normally displays things in twips rather than pixels, and if your monitor is not configured to exactly handle the image, Windows will do some image manipulation to try to figure out how to tell the monitor to display the image.

That is, if you have an image that is one pixel by one pixel, you will not necessarily see one pixel on the monitor.  That's because Windows interprets this pixel as twips (with 20 twips per point/1440 twips per inch, and normally either 15 or 20 pixels per inch depending on your font-size settings.)  With this translation process, the pixel image may actually show up as several monitor pixels.  This allows the screen picture to appear nice, but when you print it the result may appear slightly different.

Aside from that, you also get the issue of light sources.  Monitors use the additive process of light, which makes green plus blue plus red mix to make white.  Printouts use the subtractive process of light, which makes green plus cyan plus magenta mix to make black.  This results in some possible translation issues when going from a colored screen pixels to a printed pixel.

At this point, I don't know if any of the above helps, so I'll stop rambling on.
LVL 18

Expert Comment

ID: 7175966
My guess on the difference in quality while printing has to do with the DPI resolution of the image.  You might think that the visual display would be equal in resolution to the DPI but it is not.  You can have two images with very different print quality that appear the same on the screen, because the screen is actually much lower resolution than the printer.

TIFF format tends to be much higher quality because no compression is performed on the image, therefore no graphical data is lost.  However, the files tend to be very large.

There are a ton of graphical OCXs on the market, but I don't know of one specific one to recommend.

There is a replacement for the VB Printer object called VSView from ComponentOne ( formerly called VideoSoft.  The VSView control allows you to format reports which can include pictures, graphics (lines, circles etc), text.  It lets you rotate fonts, add colors, whatever, and then you can print-preview it, and then send to the printer.  I don't know if it would give you any better quality than the VB Printer object, buy you can probably download a Free demo version from the website and try it out.  It's good for a lot of stuff besides, so, it's worth it in my opinion.
LVL 49

Expert Comment

ID: 8032026
Hi tppradeep18,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rspahitz's comment(s) as an answer.

tppradeep18, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Expert Comment

ID: 8095599
per recommendation

Community Support Moderator @Experts Exchange

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now