This documentation concerns the image manipulation of the tiff images generated by the museum.
Conversion: script Orginal2ReizeImage.py
----------------------------------------
**LET OP** Conversion only after the picture have metadata
The original images are stored in folder monoliths/original/tif. The originals are converted into jpg,png and tif based on the following properties: "10per", "1per", "20_200", "40_400", "50per", "original" bellow we have the folder structure
```
.
├── 10per
│ ├── jpg
│ ├── png
│ └── tif
├── 1per
│ ├── jpg
│ ├── png
│ └── tif
├── 20_200
│ ├── jpg
│ ├── png
│ └── tif
├── 40_400
│ ├── jpg
│ ├── png
│ └── tif
├── 50per
│ ├── jpg
│ ├── png
│ └── tif
├── 80_800
│ ├── jpg
│ ├── png
│ └── tif
└── original
├── jpg
├── png
└── tif
```
Conversion is done using `magick library` that can be used on the command line, for example
Note: the -delete 1--1 is due to the fact that some tiffs have 3 layers, one with the full profile, another with the profile without measurement tape and the third with a measurement tape.
To facilitate conversion we use the python script as command: `tiff2Images.py`
Note: the script uses `shell=True` (bad, bad, bad !!!)
Adding extra information
------------------------
Extra tags are generated but to include WOSIS, ISIS information. This is done with extra scripts. We have different information according to the possibilities of the image format since JPEG can have more tags than PNG and in turn tiff has only generic tags
**TIFF:**
```
e,g: gdalinfo NL-039-def.50per.tif
Metadata:
TIFFTAG_ARTIST=ISRIC - Theo Jacobs
TIFFTAG_COPYRIGHT=ISRIC - CC BY 4.0 http://creativecommons.org/licenses/by/4.0/
TIFFTAG_DOCUMENTNAME=ZM-010-def.50per.tif
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
TIFFTAG_XRESOLUTION=96.000008
TIFFTAG_YRESOLUTION=96.000008
```
**JPEG:**
```
e.g: exif NL-039-def.50per.jpg
EXIF tags in 'FR-002-def.50per.jpg' ('Intel' byte order):
To check the image information we can use the following commands:
```
# for png and also tif
identify -verbose AU-002-def.40_400.png
# for jpeg we have exif
exif KE-051a-def.80_800.jpg
```
Python scripts
==============
There are several python script that can be run according to their functionalities. They require `GExiv2` library, which can be a problem to install. The best strategy is using packages:
left join web_isis.vw_isis_wrb_classification_profile as cl ON cl.profile_id=p.profile_id
where (p.geom is NOT NULL and cl.classification<>'');
```
Notice that the Postgresql export makes CSV with `;` and we need to change it or save it on a proper format
Script profilesCodeGeomPicture.py
---------------------------------
This script converts the output CSV into a correct CSV with extra information. The script will crawl the files present and generate a CSV with filename and only with the images found. Therefore the script needs to be set with proper file names and outputs. For example the DB information like `PE021` needs to be transformed into `PE-021-def.80_800.tif`
TODO: Change this script into a python command using click package and rename it
Script addCopyright.py
---------------------
This script will add metadata content mainly *Artist* and *Copyright*
Script addCoordsComments.py
---------------------------
This script will add coordinates + comments, this script will use the CSV file with filenames to set the properties. It had some geocoding capabilities but is to old to be properly working