Skip to content

Commit

Permalink
Update documents.
Browse files Browse the repository at this point in the history
  • Loading branch information
hMatoba committed Sep 4, 2018
1 parent c566097 commit 8937064
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ before_deploy:
- mkdir piexifjs
- cp ./dist/piexifjs.js ./piexifjs/
- cp ./dist/piexifjs.js.map ./piexifjs/
- cp ./README.rst ./piexifjs/
- cp ./README.md ./piexifjs/
- cp ./LICENSE.txt ./piexifjs/
- zip -r piexifjs.zip ./piexifjs
- rm -rf piexifjs
Expand Down
14 changes: 13 additions & 1 deletion docs/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
About Piexifjs
==============

Notice and Warning!
-------------------

We are implementing v2.0. This version would include a few big changes. If you won't ready to use, don't update this library.

- Change namespace from *pixif* to *piexifjs* in browser environment.
- add some arguments type checks
- stop to support bower
- some data types are changed in exif object...?

Some names in this libary will be changed until beta version.

What for?
---------

Expand All @@ -25,7 +37,7 @@ No dependencies.
Environment
-----------

Tested on IE11, Opera28, and PhantomJS 1.9.8. It runs on even Node.js.
Both client-side and server-side. Standard browsers(without IE) and Node.js.

License
-------
Expand Down
5 changes: 5 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

2.0.0(Not yet)
--------------



1.03
----

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
author = 'hMatoba'

# The short X.Y version
version = '1.0'
version = '2.0'
# The full version, including alpha/beta/rc tags
release = '1.0'
release = '2.0'


# -- General configuration ---------------------------------------------------
Expand Down
42 changes: 21 additions & 21 deletions docs/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Functions
load
----

.. js:function:: piexif.load(jpegData)
.. js:function:: piexifjs.load(jpegData)

Get exif data as *object*. jpegData must be a *string* that starts with "\data:image/jpeg;base64,"(DataURL), "\\xff\\xd8", or "Exif".

Expand All @@ -19,21 +19,21 @@ load

::

var exifObj = piexif.load(jpegData);
var exifObj = piexifjs.load(jpegData);
for (var ifd in exifObj) {
if (ifd == "thumbnail") {
continue;
}
console.log("-" + ifd);
for (var tag in exifObj[ifd]) {
console.log(" " + piexif.TAGS[ifd][tag]["name"] + ":" + exifObj[ifd][tag]);
console.log(" " + piexifjs.constants.Tags[ifd][tag]["name"] + ":" + exifObj[ifd][tag]);
}
}

dump
----

.. js:function:: piexif.dump(exifObj)
.. js:function:: piexifjs.dump(exifObj)

Get exif binary as *string* to insert into JPEG.

Expand All @@ -46,28 +46,28 @@ dump
var zeroth = {};
var exif = {};
var gps = {};
zeroth[piexif.ImageIFD.Make] = "Make";
zeroth[piexif.ImageIFD.XResolution] = [777, 1];
zeroth[piexif.ImageIFD.YResolution] = [777, 1];
zeroth[piexif.ImageIFD.Software] = "Piexifjs";
exif[piexif.ExifIFD.DateTimeOriginal] = "2010:10:10 10:10:10";
exif[piexif.ExifIFD.LensMake] = "LensMake";
exif[piexif.ExifIFD.Sharpness] = 777;
exif[piexif.ExifIFD.LensSpecification] = [[1, 1], [1, 1], [1, 1], [1, 1]];
gps[piexif.GPSIFD.GPSVersionID] = [7, 7, 7, 7];
gps[piexif.GPSIFD.GPSDateStamp] = "1999:99:99 99:99:99";
zeroth[piexifjs.constants.TagValues.ImageIFD.Make] = "Make";
zeroth[piexifjs.constants.TagValues.ImageIFD.XResolution] = [777, 1];
zeroth[piexifjs.constants.TagValues.ImageIFD.YResolution] = [777, 1];
zeroth[piexifjs.constants.TagValues.ImageIFD.Software] = "Piexifjs";
exif[piexifjs.constants.TagValues.ExifIFD.DateTimeOriginal] = "2010:10:10 10:10:10";
exif[piexifjs.constants.TagValues.ExifIFD.LensMake] = "LensMake";
exif[piexifjs.constants.TagValues.ExifIFD.Sharpness] = 777;
exif[piexifjs.constants.TagValues.ExifIFD.LensSpecification] = [[1, 1], [1, 1], [1, 1], [1, 1]];
gps[piexifjs.constants.TagValues.GPSIFD.GPSVersionID] = [7, 7, 7, 7];
gps[piexifjs.constants.TagValues.GPSIFD.GPSDateStamp] = "1999:99:99 99:99:99";
var exifObj = {"0th":zeroth, "Exif":exif, "GPS":gps};
var exifbytes = piexif.dump(exifObj);
var exifbytes = piexifjs.dump(exifObj);

Properties of *piexif.ImageIFD* help to make 0thIFD and 1stIFD. *piexif.ExifIFD* is for ExifIFD. *piexif.GPSIFD* is for GPSIFD. *piexif.InteropIFD* is for InteroperabilityIFD.
Properties of *piexifjs.constants.TagValues.ImageIFD* help to make 0thIFD and 1stIFD. *piexifjs.constants.TagValues.ExifIFD* is for ExifIFD. *piexifjs.constants.TagValues.GPSIFD* is for GPSIFD. *piexifjs.InteropIFD* is for InteroperabilityIFD.

.. note:: ExifTag(34665), GPSTag(34853), and InteroperabilityTag(40965) in 0thIFD automatically are set appropriate value.
.. note:: JPEGInterchangeFormat(513), and JPEGInterchangeFormatLength(514) in 1stIFD automatically are set appropriate value.
.. note:: If 'thumbnail' is contained in *exifObj*, '1st' must be contained -- and vice versa. 1stIFD means thumbnail's information.

insert
------
.. js:function:: piexif.insert(exifbytes, jpegData)
.. js:function:: piexifjs.insert(exifbytes, jpegData)

Insert exif into JPEG.

Expand All @@ -78,12 +78,12 @@ insert

::

var exifbytes = piexif.dump(exifObj)
var newJpeg = piexif.insert(exifbytes, jpegData)
var exifbytes = piexifjs.dump(exifObj)
var newJpeg = piexifjs.insert(exifbytes, jpegData)

remove
------
.. js:function:: piexif.remove(jpegData)
.. js:function:: piexifjs.remove(jpegData)

Remove exif from JPEG.

Expand All @@ -93,4 +93,4 @@ remove

::

var newJpeg = piexif.remove("foo.jpg")
var newJpeg = piexifjs.remove(jpegData)
18 changes: 0 additions & 18 deletions docs/installation.rst

This file was deleted.

66 changes: 33 additions & 33 deletions docs/sample.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ Insert Exif into jpeg
::

<input type="file" id="files" />
<script source="/js/piexif.js" />
<script source="/js/piexifjs.js" />
<script>
function handleFileSelect(evt) {
var file = evt.target.files[0];
var zeroth = {};
var exif = {};
var gps = {};
zeroth[piexif.ImageIFD.Make] = "Make";
zeroth[piexif.ImageIFD.XResolution] = [777, 1];
zeroth[piexif.ImageIFD.YResolution] = [777, 1];
zeroth[piexif.ImageIFD.Software] = "Piexifjs";
exif[piexif.ExifIFD.DateTimeOriginal] = "2010:10:10 10:10:10";
exif[piexif.ExifIFD.LensMake] = "LensMake";
exif[piexif.ExifIFD.Sharpness] = 777;
exif[piexif.ExifIFD.LensSpecification] = [[1, 1], [1, 1], [1, 1], [1, 1]];
gps[piexif.GPSIFD.GPSVersionID] = [7, 7, 7, 7];
gps[piexif.GPSIFD.GPSDateStamp] = "1999:99:99 99:99:99";
zeroth[piexifjs.constants.TagValues.ImageIFD.Make] = "Make";
zeroth[piexifjs.constants.TagValues.ImageIFD.XResolution] = [777, 1];
zeroth[piexifjs.constants.TagValues.ImageIFD.YResolution] = [777, 1];
zeroth[piexifjs.constants.TagValues.ImageIFD.Software] = "Piexifjs";
exif[piexifjs.constants.TagValues.ExifIFD.DateTimeOriginal] = "2010:10:10 10:10:10";
exif[piexifjs.constants.TagValues.ExifIFD.LensMake] = "LensMake";
exif[piexifjs.constants.TagValues.ExifIFD.Sharpness] = 777;
exif[piexifjs.constants.TagValues.ExifIFD.LensSpecification] = [[1, 1], [1, 1], [1, 1], [1, 1]];
gps[piexifjs.constants.TagValues.GPSIFD.GPSVersionID] = [7, 7, 7, 7];
gps[piexifjs.constants.TagValues.GPSIFD.GPSDateStamp] = "1999:99:99 99:99:99";
var exifObj = {"0th":zeroth, "Exif":exif, "GPS":gps};
var exifbytes = piexif.dump(exifObj);
var exifbytes = piexifjs.dump(exifObj);

var reader = new FileReader();
reader.onload = function(e) {
var inserted = piexif.insert(exifbytes, e.target.result);
var inserted = piexifjs.insert(exifbytes, e.target.result);

var image = new Image();
image.src = inserted;
Expand All @@ -53,14 +53,14 @@ Read Exif Values

var reader = new FileReader();
reader.onloadend = function(e) {
var exifObj = piexif.load(e.target.result);
var exifObj = piexifjs.load(e.target.result);
for (var ifd in exifObj) {
if (ifd == "thumbnail") {
continue;
}
console.log("-" + ifd);
for (var tag in exifObj[ifd]) {
console.log(" " + piexif.TAGS[ifd][tag]["name"] + ":" + exifObj[ifd][tag]);
console.log(" " + piexifjs.constants.Tags[ifd][tag]["name"] + ":" + exifObj[ifd][tag]);
}
}
};
Expand Down Expand Up @@ -96,10 +96,10 @@ Generates Rotated JPEG

var reader = new FileReader();
reader.onload = function(e) {
var exif = piexif.load(e.target.result);
var exif = piexifjs.load(e.target.result);
var image = new Image();
image.onload = function () {
var orientation = exif["0th"][piexif.ImageIFD.Orientation];
var orientation = exif["0th"][piexifjs.constants.TagValues.ImageIFD.Orientation];

var canvas = document.createElement("canvas");
canvas.width = image.width;
Expand Down Expand Up @@ -181,10 +181,10 @@ GPS Coordinates

var lat = 59.43553989213321;
var lng = 24.73842144012451;
gpsIfd[piexif.GPSIFD.GPSLatitudeRef] = lat < 0 ? 'S' : 'N';
gpsIfd[piexif.GPSIFD.GPSLatitude] = piexif.GPSHelper.degToDmsRational(lat);
gpsIfd[piexif.GPSIFD.GPSLongitudeRef] = lng < 0 ? 'W' : 'E';
gpsIfd[piexif.GPSIFD.GPSLongitude] = piexif.GPSHelper.degToDmsRational(lng);
gpsIfd[piexifjs.constants.TagValues.GPSIFD.GPSLatitudeRef] = lat < 0 ? 'S' : 'N';
gpsIfd[piexifjs.constants.TagValues.GPSIFD.GPSLatitude] = piexifjs.GPSHelper.degToDmsRational(lat);
gpsIfd[piexifjs.constants.TagValues.GPSIFD.GPSLongitudeRef] = lng < 0 ? 'W' : 'E';
gpsIfd[piexifjs.constants.TagValues.GPSIFD.GPSLongitude] = piexifjs.GPSHelper.degToDmsRational(lng);


Node.js
Expand All @@ -204,19 +204,19 @@ Node.js
var zeroth = {};
var exif = {};
var gps = {};
zeroth[piexif.ImageIFD.Make] = "Make";
zeroth[piexif.ImageIFD.XResolution] = [777, 1];
zeroth[piexif.ImageIFD.YResolution] = [777, 1];
zeroth[piexif.ImageIFD.Software] = "Piexifjs";
exif[piexif.ExifIFD.DateTimeOriginal] = "2010:10:10 10:10:10";
exif[piexif.ExifIFD.LensMake] = "LensMake";
exif[piexif.ExifIFD.Sharpness] = 777;
exif[piexif.ExifIFD.LensSpecification] = [[1, 1], [1, 1], [1, 1], [1, 1]];
gps[piexif.GPSIFD.GPSVersionID] = [7, 7, 7, 7];
gps[piexif.GPSIFD.GPSDateStamp] = "1999:99:99 99:99:99";
zeroth[piexifjs.constants.TagValues.ImageIFD.Make] = "Make";
zeroth[piexifjs.constants.TagValues.ImageIFD.XResolution] = [777, 1];
zeroth[piexifjs.constants.TagValues.ImageIFD.YResolution] = [777, 1];
zeroth[piexifjs.constants.TagValues.ImageIFD.Software] = "Piexifjs";
exif[piexifjs.constants.TagValues.ExifIFD.DateTimeOriginal] = "2010:10:10 10:10:10";
exif[piexifjs.constants.TagValues.ExifIFD.LensMake] = "LensMake";
exif[piexifjs.constants.TagValues.ExifIFD.Sharpness] = 777;
exif[piexifjs.constants.TagValues.ExifIFD.LensSpecification] = [[1, 1], [1, 1], [1, 1], [1, 1]];
gps[piexifjs.constants.TagValues.GPSIFD.GPSVersionID] = [7, 7, 7, 7];
gps[piexifjs.constants.TagValues.GPSIFD.GPSDateStamp] = "1999:99:99 99:99:99";
var exifObj = {"0th":zeroth, "Exif":exif, "GPS":gps};
var exifbytes = piexif.dump(exifObj);
var exifbytes = piexifjs.dump(exifObj);

var newData = piexif.insert(exifbytes, data);
var newData = piexifjs.insert(exifbytes, data);
var newJpeg = new Buffer(newData, "binary");
fs.writeFileSync(filename2, newJpeg);
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "piexifjs-pre",
"version": "2.0.0-alpha002",
"name": "piexifjs",
"version": "2.0.0-alpha.003",
"description": "Read and write exif.",
"main": "dist/piexifjs.js",
"files": [
"dist/piexifjs.js",
"dist/piexifjs.js.map",
"LICENSE.txt",
"README.md",
"package.json"
],
"repository": {
Expand Down

0 comments on commit 8937064

Please sign in to comment.