MATLAB Answers

How can I read an image file that is stored in PDF format (much like reading a jpeg file with I = imread('image.jpg')?

124 ビュー (過去 30 日間)
Douglas Chai
Douglas Chai 2015 年 5 月 21 日
コメント済み: Douglas Chai 2021 年 1 月 6 日
At the moment, I have to first convert (outside MATLAB) the image from PDF to JPEG format so that I can use imread in MATLAB. Is there a direct way to read in a (single page) PDF file as an image? Many thanks.
  2 件のコメント



Stephen Cobeldick
Stephen Cobeldick 2015 年 5 月 21 日
編集済み: Stephen Cobeldick 2015 年 5 月 21 日
The short answer is: no.
The PDF "standard" is not an image file format, although in some ways the entire PDF is a bit like an image, in that it contains information about the locations and presentation of elements on a page. This means that it is extremely versatile, but also very unwieldy and not very friendly for the simple extraction of text or images. If the image that you want is an embedded bitmap image (e.g. JPG, etc), then there may be some tool for extracting this. If it is something like an EPS, then it may be easier to convert this to EPS and import this format into MATLAB.
These might be interesting for you to read:
  1 件のコメント
Douglas Chai
Douglas Chai 2015 年 5 月 21 日
Thank you Stephen. Your first link is useful.


その他の回答 (1 件)

Stefanie Schwarz
Stefanie Schwarz 2021 年 1 月 5 日
There is a way to import a PDF as image in MATLAB by making use of the Apache PDFBox library that we ship.
Please see the following post for the code:
  1 件のコメント
Douglas Chai
Douglas Chai 2021 年 1 月 6 日
Thank you Stefanie. It works beautifully. Much appreciated for your help.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by