Hi All,i decided to use a tool for this purpose. now i am lazy to integrate
a scaling function into my code..
i found ImageMagick and i will use converter.exe of this library.
now i changed my function like:

///////////////////////////////////////////////////////////////////////////////////////////////////////
void simUtil::SimImageUtils::scaleAndSaveImage( osg::Image* image, float
scaleFactor, const std::string& outputFilename )
{
std::ostringstream command;
command << "converter.exe " << image->getFileName() << " -resize " <<
image->s() * scaleFactor << " " << image->t() * scaleFactor << " " <<
outputFilename;
system(command.str().c_str());
}
///////////////////////////////////////////////////////////////////////////////////////////////////////

thanks to all...

On Fri, Aug 21, 2009 at 9:12 AM, J.P. Delport <[email protected]> wrote:

> Hi Ufuk,
>
> Ufuk wrote:
>
>> actually i just want to have a scale code of image..
>>
>> half and quarter resolution would be enough for me.. i wanted to scale
>> them when i create terrain.
>>
>
> if you are working with terrain I would suggest you also look at the GDAL
> functions/lib. E.g. have a look at the gdaladdo man page, it is a command
> line app that builds overview images, but you could use the same
> functionality directly from your application if you link to GDAL. You might
> also find some other helpful functions.
>
> jp
>
>
>> i have a terrain editor and viewer which are 2 separate programs.
>> on editor, in saving process, i want to store lower resolution textures
>> too and i wanted to create in my program.
>>
>> my terrain viewer program will load all textures and use low resolution
>> textures for pages which are far away from the camera..
>>
>> i don't want to use .dds because in terrain editor, user can use any
>> texture he wants. so i don't want to give up texture selection dynamism
>> here.. i can't limit users just with my textures which are selected before.
>>
>> On Thu, Aug 20, 2009 at 5:58 PM, Ümit Uzun <[email protected] <mailto:
>> [email protected]>> wrote:
>>
>>    Hi Ufuk;
>>
>>    If you want to create mippaped images on your disk instead of
>>    programmaticaly. I suggest you to use GIMP to mipmap(rescale each
>>    different resolution image separately) and when you need you can
>>    call related resolution image :)
>>
>>    Is this your expected or you want to create one image which has all
>>    resoluted images in it? If you want kind of this operation you can
>>    use dds format. But I don't know osg does support reading mipmapped
>>    dds format.
>>
>>
>>    Regards.
>>
>>    Ümit Uzun
>>
>>
>>    2009/8/20 Ufuk <[email protected] <mailto:[email protected]>>
>>
>>        Hi Ümit,
>>        yes, i need mipmapping but i want to store these mipmapped
>>        textures on disk. i dont want so many calculations on rendering...
>>        so i wanted to store these images on disk.
>>
>>        do you know a way to do this or i should write a code?
>>
>>
>>        On Thu, Aug 20, 2009 at 5:43 PM, Ümit Uzun <[email protected]
>>        <mailto:[email protected]>> wrote:
>>
>>            Hi Ufuk;
>>
>>            Compress word doesn't define your expected operation very
>>            well. This operation's name is Mipmapping. You should
>>            generate automatic mipmapping for your texture in runtime
>>            and the you can choose any resolution you have created to
>>            use your program.
>>
>>            Regards.
>>
>>            Ümit Uzun
>>
>>
>>            2009/8/20 Ufuk <[email protected] <mailto:[email protected]
>> >>
>>
>>                is there any function that compress image in osg?
>>
>>                for example i have an 256x256 image and i want to
>>                compress it to 128x128 or 64x64...
>>
>>                i checked for osg::Image::scaleImage() but it did not
>>                change the resolution.. maybe i did something wrong?
>>
>>                Here is the code:
>>
>>
>>  
>> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>                void simUtil::SimImageUtils::scaleAndSaveImage(
>>                osg::Image* image, float scaleFactor, const std::string&
>>                filename )
>>                {
>>                   osg::ref_ptr<osg::Image> cImage = new
>> osg::Image(*image);
>>
>>                   cImage->scaleImage(image->s() * scaleFactor,
>>                image->t() * scaleFactor, image->r() * scaleFactor);
>>
>>                   osgDB::writeImageFile(*image, filename);
>>                }
>>
>>  
>> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>
>>                --                Ufuk
>>
>>                _______________________________________________
>>                osg-users mailing list
>>                [email protected]
>>                <mailto:[email protected]>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>>
>>            _______________________________________________
>>            osg-users mailing list
>>            [email protected]
>>            <mailto:[email protected]>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>>
>>
>>        --        Ufuk
>>
>>        _______________________________________________
>>        osg-users mailing list
>>        [email protected]
>>        <mailto:[email protected]>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>>
>>    _______________________________________________
>>    osg-users mailing list
>>    [email protected]
>>    <mailto:[email protected]>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>>
>>
>> --
>> Ufuk
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
> --
> This message is subject to the CSIR's copyright terms and conditions,
> e-mail legal notice, and implemented Open Document Format (ODF) standard.
> The full disclaimer details can be found at
> http://www.csir.co.za/disclaimer.html.
>
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.  MailScanner thanks Transtec
> Computers for their support.
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Ufuk
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to