Author |
Topic  |
|
ovince
Yugoslavia
Posts |
Posted - 10/03/2006 : 01:40:02 AM
|
hello to everybody,
I have made BMP images from my graphs and I am curious about several things:
1. When printing Graphs/Layouts directly from Origin I have a very nice resolution pictures. On the other hand, creating BMP images first and printing afterwards gives quite bad resolution pictures. Why Is that? Is there a way to improve it?
2. Is there any other formats (JPG and others) where this is not happening or it does but in smaller amount?
3. Should the code line (see bellow)
int nBitsPerPixel = 16;
improve the resolution with higher numbers? If yes, why it is not happening in practice?
This is the code from Origins exaple list:
void export_all_graphs_to_BMP() { string cur_path; cur_path = Project.GetPath(); printf("current path: %s\n", cur_path); foreach( PageBase pgb in Project.Pages ) { string name; name = pgb.GetName(); name = name.Left(5); //printf("str2 is: %s\n", name); // if graph page if( (EXIST_PLOT == pgb.GetType()) && (name == "Graph")) { // Export format string strFormat = "BMP"; // Width in pixels int nWidth = 1024; // Get page properties and set height appropriately to // maintain aspect ratio GraphPage gpg = pgb; int nHeight = (int) (nWidth * gpg.Dimension.Height.dVal / gpg.Dimension.Width.dVal); // Bits per pixel int nBitsPerPixel = 16; // Set export file path to be in the User Files folder - change as desired string strImagePath = cur_path + gpg.GetName() + ".BMP"; printf("File: %s\n", strImagePath); // Call function to export page with desired settings BOOL bRet = export_page_to_image(strImagePath, strFormat, pgb, nWidth, nHeight, nBitsPerPixel); // Report on error if( !bRet ) printf("Failed to export graph page: %s\n", pgb.GetName()); } } }
Thanks for you time oliver |
|
Deanna
China
Posts |
Posted - 10/08/2006 : 01:20:17 AM
|
Dear Oliver,
1. In my opinion, the "bad resolution" arise from assigning too small values to nWidth and nHeight in the function: bool export_page_to_image(LPCSTR lpcszFileName, LPCSTR lpcszFormat, Page &pg, int nWidth, int nHeight, int nBitsPerPixel, int nCompression=0)
These two parameters nWidth and nHeight represent target image width in pixels and the target image height in pixels. They determine the resolution of the target image. When they are smaller than their counterparts of the original graph, the target image can be viewed as a down-sampled image of the input graph, which means the resolution will decrease. When they are too small, the resolution will not be satisfying.
When you print a graph directly from Origin, the resoluion will not be down-graded. Therefore you can get better pictures.
If you want to improve the resolution of the output bitmaps, just increase nWidth and nHeight.
2. This has little to do with the formats. In any format, the resolution can be determined in the same way.
3. BitsPerPixel cannot determine the resolution. In fact, it is used for the color depth.
If you are interested in the concepts of DPI, resolution, color depth, etc. you can refer to this webpage http://www.wildpicture.com/pages/photography/dpi.htm
Deanna OriginLab Technical Services |
 |
|
|
Topic  |
|
|
|