How to change image resolution

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Kuzma

How to change image resolution

Post by Kuzma »

I have some Magick++ API.

Code: Select all

    vector<Blob> vector_blob;
    Blob temp_blob;
    vector<size_t> data_size;
    size_t temp_data_size;
    vector<char *>dib;
    char * temp_dib;
    int number_of_page;
    Image image;
    try {
	vector<Image> imageVector;
	cout << "Create imageVector\n";
	readImages( &imageVector, fname);
	cout << "read image to imageVector\n";
...
    image.write( "x.bmp" );
fname is pdf file. I write first page of it on Image image. I get image file with default density 72dpi. I want a resolution 300. How to set a resolution of each Image in imageVector to 300?
Please help me.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to change image resolution

Post by magick »

Have you tried the density() or the STL densityImage() methods?
Kuzma

Re: How to change image resolution

Post by Kuzma »

Yes, I try.
I write

Code: Select all

...
readImages( &imageVector, fname);
for_each(imageVector.begin(),imageVector.end(),densityImage("300x300") );
...
with no results.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to change image resolution

Post by magick »

What image format are you writing? Some program only recognize the image resolution if its embedded in an EXIF profile.
Kuzma

Re: How to change image resolution

Post by Kuzma »

I write to Blob object.
But I think the problem that there are not member function like set_default_density(...) or/ and set_default_resolution(...).
I reading pdf from file (and have set up default density to 72) and after reading to vector<Image> I try change resolution, but pdf is already converted with default resolution.
Is it my utterance correct?
Kuzma

Re: How to change image resolution

Post by Kuzma »

Please help me/give me example
Post Reply