掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
jpeg画像を90度回転させる (ID:61228)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
以前同じタイトルで質問して、下記のコードを教わりました。 質疑のURLは、 http://madia.world.coocan.jp/cgi-bin/Vcbbs/wwwlng.cgi?print+200603/06030044.txt です。 CImage inPhoto; inPhoto.Load(mych1); int sWidth = inPhoto.GetWidth(); int sHeight = inPhoto.GetHeight(); int bpp = inPhoto.GetBPP(); int inphotoPitch = inPhoto.GetPitch(); unsigned char *inphotoBuffer = (unsigned char *)inPhoto.GetBits(); if(bpp < 8) {return; } CImage outPhoto; outPhoto.Create(sHeight, sWidth, bpp); int outphotoPitch = outPhoto.GetPitch(); unsigned char *outphotoBuffer = (unsigned char *)outPhoto.GetBits(); int bytepp = bpp / 8; for(int x = 0 ; x < sWidth ; ++x){ for(int y = 0 ; y < sHeight ; ++y){ destX = y; destY = sWidth - x - 1; unsigned char *read = inphotoBuffer + x * bytepp + y * inphotoPitch; unsigned char *write = outphotoBuffer + destX * bytepp + destY * outphotoPitch; for(int c = 0 ; c < bytepp ; ++c) {*write++ = *read++; } } } outPhoto.Save(mych1); mych1は、写真ファイルのバスです。 これですいすい回転(正確にはX軸とY軸の置換え)させられるのですが、ファイルのバイト数が、1/3くらいになってしまいます。 大きさは変わらず、画質も拡大してみても劣化はしていないようなのですが、バイト数だけ減ります。 圧縮率の問題かとも思うのですが、原因が分からず、改めてお尋ねしました。 WINXP .NET MFC です。 よろしくお願いいたします。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.