Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[14546] [질문]jpg 파일의 dpi 가져오는 방법???
쿠핑 [couping] 2095 읽음    2013-01-02 12:04
안녕하세여

새해 복 많이 받으세요

다름이 아니라 jpg 파일에서의 이미지 속성중 dpi 부분을 가져오고 싶은데

procedure TfrmMain.Button2Click(Sender: TObject);
const
  BufferSize = 50;
var
  Buffer : String;
  index : Integer;
  FileStream : TFileStream;
  xResolution: Word;
  yResolution: Word;
begin
  if OpenDialog1.Execute then
  begin
    FileStream := TFileStream.Create(OpenDialog1.FileName,
    fmOpenRead or fmShareDenyNone);
    try
      SetLength(Buffer, BufferSize);
      FileStream.Read(buffer[1], BufferSize);
      index := Pos('JFIF'+#$00, buffer);
      if index > 0 then
      begin
        FileStream.Seek(index+7, soFromBeginning);
        FileStream.Read(xResolution, 2);
        FileStream.Read(yResolution, 2);

        xResolution := Swap(xResolution);
        yResolution := Swap(yResolution);

        ShowMessage('xResolution=' +
        IntToStr(xResolution) +
        ', yResolution=' +
        IntToStr(yResolution))
      end;
    finally
      FileStream.Free
    end;
  end;

end;

이렇게 했는데 Index 값이 0이 나와 dpi를 가져 오지를 못합니다.

어떻게 하는지 좀 간곡한 부탁드립니다.

+ -

관련 글 리스트
14546 [질문]jpg 파일의 dpi 가져오는 방법??? 쿠핑 2095 2013/01/02
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.