Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.12.25;
Скачать: CL | DM;

Вниз

Как прграммно изменить разрешение рисунка?   Найти похожие ветки 

 
ShotGun ©   (2005-07-19 09:24) [0]

Как можно это сделать? Кто может помочь?


 
dmk ©   (2005-07-20 20:17) [1]

Ознакомься с парой-тройкой алгоритмов ресемплинга.
Выбери подходящий и банзай.


 
Gydvin ©   (2005-07-22 08:39) [2]

Вот  гдето выдрал и доделал,  у меня работает

procedure tkart.SetResJpg(filename: string; dpix, dpiy: Integer);
const
  BufferSize = 50;
  DPI = 1; //inch
 DPC = 2; //cm
var
  Buffer: string;
  index: INTEGER;
  FileStream: TFileStream;
  xResolution: WORD;
  yResolution: WORD;
  _type: Byte;
begin
  FileStream := TFileStream.Create(name,
    fmOpenReadWrite);
  try
    SetLength(Buffer, BufferSize);
    FileStream.Read(buffer[1], BufferSize);
    index := POS("JFIF",buffer);
    if index > 0
      then begin
      FileStream.Seek(index + 6, soFromBeginning);
      _type := DPI;
      FileStream.write(_type, 1);
      xresolution := swap(dpix);
      FileStream.write(xresolution, 2);
      yresolution := swap(dpiy);
      FileStream.write(yresolution, 2);
    end  ;

    index := POS("BM",buffer);
    if index > 0
      then begin
      FileStream.Seek(index + 37, soFromBeginning);
     // FileStream.write(_type, 1);
      xresolution :=  strtoint(floattostr(RoundFloat(strtofloat(inttostr(dpix))*39.4,0)));
      //swap(dpix);
   //   showmessage(floattostr(RoundFloat(strtofloat(inttostr(xresolution))/39.4,0)));
      FileStream.write(xresolution, 2);
       FileStream.Seek(index + 41, soFromBeginning);
      yresolution :=strtoint(floattostr(RoundFloat(strtofloat(inttostr(dpiy))*39.4,0)));

      //swap(dpiy);
      FileStream.write(yresolution, 2);
    end

  finally
    FileStream.Free;
  end;
end;


 
Gydvin ©   (2005-07-22 08:41) [3]

Тоесть

FileStream := TFileStream.Create(name,
    fmOpenReadWrite); следует читать как

FileStream := TFileStream.Create(filename,
    fmOpenReadWrite);



Страницы: 1 вся ветка

Текущий архив: 2005.12.25;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.045 c
14-1133597294
psa247
2005-12-03 11:08
2005.12.25
Константы Server 2003 !


1-1132906451
vl1639
2005-11-25 11:14
2005.12.25
о компоненте StringGrid


2-1133951025
Piero
2005-12-07 13:23
2005.12.25
Опять вопрос про классы


14-1133348890
syte_ser78
2005-11-30 14:08
2005.12.25
Оцените доменное имя


8-1121695720
Yandexman
2005-07-18 18:08
2005.12.25
Музыка в проектах.