Skip to content

Commit

Permalink
Edited docstring. [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
hMatoba committed Jan 31, 2015
1 parent 910b344 commit b53db83
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 76 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

0.7.1
------------------

- Edited docstring.

0.7.0c
------

Expand Down
Binary file modified doc/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified doc/_build/doctrees/index.doctree
Binary file not shown.
4 changes: 2 additions & 2 deletions doc/_build/html/_sources/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
Welcome to Piexif's documentation!
==================================

To simplify exif manipulations with python. Writing, reading, and more... Piexif isn't a wrapper. To everywhere with Python.

.. image:: https://travis-ci.org/hMatoba/Piexif.svg?branch=master
:target: https://travis-ci.org/hMatoba/Piexif
.. image:: https://coveralls.io/repos/hMatoba/Piexif/badge.svg?branch=master
:target: https://coveralls.io/r/hMatoba/Piexif?branch=master
.. image:: https://readthedocs.org/projects/piexif/badge/?version=latest
:target: https://readthedocs.org/projects/piexif/

To simplify exif manipulations with python. Writing, reading, and more... Piexif isn't a wrapper. To everywhere with Python.

.. toctree::
:maxdepth: 2

Expand Down
2 changes: 1 addition & 1 deletion doc/_build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@

<div class="section" id="welcome-to-piexif-s-documentation">
<h1>Welcome to Piexif&#8217;s documentation!<a class="headerlink" href="#welcome-to-piexif-s-documentation" title="Permalink to this headline"></a></h1>
<p>To simplify exif manipulations with python. Writing, reading, and more... Piexif isn&#8217;t a wrapper. To everywhere with Python.</p>
<a class="reference external image-reference" href="https://travis-ci.org/hMatoba/Piexif"><img alt="https://travis-ci.org/hMatoba/Piexif.svg?branch=master" src="https://travis-ci.org/hMatoba/Piexif.svg?branch=master" /></a>
<a class="reference external image-reference" href="https://coveralls.io/r/hMatoba/Piexif?branch=master"><img alt="https://coveralls.io/repos/hMatoba/Piexif/badge.svg?branch=master" src="https://coveralls.io/repos/hMatoba/Piexif/badge.svg?branch=master" /></a>
<a class="reference external image-reference" href="https://readthedocs.org/projects/piexif/"><img alt="https://readthedocs.org/projects/piexif/badge/?version=latest" src="https://readthedocs.org/projects/piexif/badge/?version=latest" /></a>
<p>To simplify exif manipulations with python. Writing, reading, and more... Piexif isn&#8217;t a wrapper. To everywhere with Python.</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="about.html">About Piexif</a><ul>
Expand Down
5 changes: 2 additions & 3 deletions doc/_build/html/objects.inv
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
# Project: Piexif
# Version: 0.7.0
# The remainder of this file is compressed using zlib.
xڍ�1
�0 �ݧ��Ys��BO�FJb�ec;%�})��Bo���A��a��J��!�Ӳ˜���4l���
Z��qw�Gr�Mݜ��n����H��+��RƉ͋��-n߬��?4����{ܙ�(����;)]��f%��΄�
xڍ�=
�0 ��=���Ys��BO��Jb�ec�%�}b�B��O�+�㴂$3��!�@>[�&G����d��o^���w��A�C�G�go2a�����}D�����yJ�3 PO��#���kӌS�,�4��IJ`l�&��?�3��
2 changes: 1 addition & 1 deletion doc/_build/html/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
Welcome to Piexif's documentation!
==================================

To simplify exif manipulations with python. Writing, reading, and more... Piexif isn't a wrapper. To everywhere with Python.

.. image:: https://travis-ci.org/hMatoba/Piexif.svg?branch=master
:target: https://travis-ci.org/hMatoba/Piexif
.. image:: https://coveralls.io/repos/hMatoba/Piexif/badge.svg?branch=master
:target: https://coveralls.io/r/hMatoba/Piexif?branch=master
.. image:: https://readthedocs.org/projects/piexif/badge/?version=latest
:target: https://readthedocs.org/projects/piexif/

To simplify exif manipulations with python. Writing, reading, and more... Piexif isn't a wrapper. To everywhere with Python.

.. toctree::
:maxdepth: 2

Expand Down
Binary file added insert.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion piexif/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from ._insert import insert


VERSION = '0.7.0c'
VERSION = '0.7.1'
13 changes: 7 additions & 6 deletions piexif/_insert.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
"""
"""

import io
import struct

from ._common import *


def insert(exif, image, new_file=""):
"""Inserts exif bytes to JPEG file
insert(exif, image, new_file[optional])
When "new_file" is not given, "image" file is overwritten.
"""
py:function:: piexif.insert(exif_bytes, filename)
Insert exif into JPEG.
:param bytes exif_bytes: Exif as bytes
:param str filename: JPEG
"""
if exif[0:6] != b"\x45\x78\x69\x66\x00\x00":
raise ValueError("Given data is not exif data")
Expand Down
59 changes: 16 additions & 43 deletions piexif/_load_and_dump.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,3 @@
"""EXIF is a set of several IFDs.
Oth IFD can include "Make", "Model" and more...
Exif IFD can include "ExposureTime", "ISOSpeed" and more...
GPS IFD can include GPS information.
Pass dict(s), that shows several IFD, to "dump" function.
exifbytes = pyxif.dump(0th_dict, exif_dict, gps_dict) # second and third are optional.
To use dict as IFD data, it needs...
A tag number means which property? - 256: ImageWidth, 272: Model...
Appropriate type for property. - long for ImageWidth, str for Model...
zeroth_ifd = {pyxif.ZerothIFD.Make: "Canon",
pyxif.ZerothIFD.XResolution: (96, 1),
pyxif.ZerothIFD.YResolution: (96, 1),
pyxif.ZerothIFD.Software: "Photoshop x.x.x",
}
Property name and tag number
For 0th IFD - under "pyxif.ZerothIFD"
For Exif IFD - under "pyxif.ExifIFD"
For GPS IFD - under "pyxif.GPSIFD"
Property and appropriate type
See variable"TAGS" in this script.
"Byte": int
"Ascii": str
"Short": int
"Long": Long
"Rational": (long, long)
"Undefined": str
"SLong": long
"SRational": (long, long)
"""

import copy
import io
import struct
Expand Down Expand Up @@ -240,9 +205,14 @@ def get_info(self, val):


def load(input_data):
r"""converts exif bytes to dicts
zeroth_dict, exif_dict, gps_dict = pyxif.load(input_data)
input_data - filename or JPEG data(b"\xff\xd8......")
r"""
py:function:: piexif.load(filename)
Return three IFD data that are 0thIFD, ExifIFD, and GPSIFD as dict.
:param str filename: JPEG or TIFF
:return: 0th IFD, Exif IFD, and GPS IFD
:rtype: dict, dict, dict
"""
exifReader = ExifReader(input_data)
if exifReader.exif_str is None:
Expand All @@ -259,11 +229,14 @@ def load(input_data):


def dump(zeroth_ifd_original, exif_ifd={}, gps_ifd={}):
"""converts dict to exif bytes
exif_bytes = pyxif.dump(zeroth_ifd, exif_ifd[optional], gps_ifd[optional])
zeroth_ifd - dict of 0th IFD
exif_ifd - dict of Exif IFD
gps_ifd - dict of GPS IFD
"""
py:function:: piexif.load(data)
Return three IFD data that are 0thIFD, ExifIFD, and GPSIFD as dict.
:param bytes data: JPEG or TIFF
:return: 0th IFD, Exif IFD, and GPS IFD
:rtype: dict, dict, dict
"""
zeroth_ifd = copy.deepcopy(zeroth_ifd_original)
header = b"\x45\x78\x69\x66\x00\x00\x4d\x4d\x00\x2a\x00\x00\x00\x08"
Expand Down
15 changes: 6 additions & 9 deletions piexif/_remove.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
"""PIL's image resize manipulation(includes thumbnail function) loses JPEG's.
Helps to transplant Exif data into another JPEG.
Tested on Python 2.7 and 3.4
"""

import io

from ._common import *


def remove(src, new_file=""):
"""Removes exif.
remove(src, new_file[optional])
src - filename or JPEG data(2.7 - str, 3.4 - bytes)
When "new_file" is not given, "src" is overwritten.
"""
py:function:: piexif.remove(filename)
Remove exif from JPEG.
:param str filename: JPEG
"""
output_is_file = False
if src[0:2] == b"\xff\xd8":
Expand Down
15 changes: 7 additions & 8 deletions piexif/_transplant.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
"""PIL's image resize manipulation(includes thumbnail function) loses JPEG's.
Helps to transplant Exif data into another JPEG.
Tested on Python 2.7 and 3.4
"""

import io

from ._common import *


def transplant(exif_src, image, new_file=""):
"""Transplants exif to another JPEG
transplant(exif_src, image, new_file[optional])
When "new_file" is not given, "image" file is overwritten.
"""
py:function:: piexif.transplant(filename1, filename2)
Transplant exif from filename1 to filename2.
:param str filename1: JPEG
:param str filename2: JPEG
"""
if exif_src[0:2] == b"\xff\xd8":
src_data = exif_src
Expand Down
Binary file added remove.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added transplant.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b53db83

Please sign in to comment.