Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Create extractImagesfrompdf.py

Abdul Wahab Junaid6d36c72f5a7f
diff --git a/Python Tools/Extract Images From PDF/extractImagesfrompdf.py b/Python Tools/Extract Images From PDF/extractImagesfrompdf.py
new file mode 100644
index 0000000..6cdf4c0
--- /dev/null
+++ b/Python Tools/Extract Images From PDF/extractImagesfrompdf.py
@@ -0,0 +1,14 @@
+#!usr/bin/env python3
+
+import fitz
+
+pdf_document = fitz.open("pdf/XMPSpecificationPart3.pdf")
+for current_page in range(len(pdf_document)):
+ for image in pdf_document.getPageImageList(current_page):
+ xref = image[0]
+ pix = fitz.Pixmap(pdf_document, xref)
+ if pix.n < 5:
+ pix.writePNG("page%s-%s.png" % (current_page, xref))
+ else:
+ pix1 = fitz.Pixmap(fitz.csRGB, pix)
+ pix1.writePNG("page%s-%s.png" % (current_page, xref))