summaryrefslogtreecommitdiff
path: root/src/jpeg-utils.h
blob: e26218ec7c141fe0f52eb81aab02e0c9c03abf55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*   Cataract - Static web photo gallery generator
 *   Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation; either version 2
 *   of the License, or any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifdef __cplusplus
  extern "C" {
#endif

#include <glib.h>
#include "setup.h"

#define SQUARED_SIMPLE_SHAVE_AMOUNT 5  /* percent */


/*  TODO: we want to have numerical values here at some point in the future  */
typedef struct {
  gchar *datetime;
  gchar *camera_model;
  gchar *iso;
  gchar *focal_length;
  gchar *focal_length_35mm;
  gchar *aperture;
  gchar *exposure;
  gchar *flash;

  gchar *exif_software;
  gchar *exif_imgdesc;
  gchar *exif_artist;
  gchar *exif_copyright;
  gchar *exif_usercomment;

  gchar *iptc_objectname;
  gchar *iptc_copyright;
  gchar *iptc_credit;
  gchar *iptc_caption;
  gchar *iptc_author;

  gchar *jpeg_comment;
} TExifData;


/*
 *   get_exif: retrieve EXIF info from a JPEG image
 */
int get_exif (const gchar *filename, TExifData **exif_data);

/*
 *   free_exif_struct: free allocated structure
 */
void free_exif_data (TExifData *data);


/*
 *   resize_image: resize image pointed by src and save result to dst
 *                 - setting thumbnail flag will remove all profiles and optimize for size
 */
gboolean resize_image (const gchar *src, const gchar *dst,
                       unsigned long size_x, unsigned long size_y,
		       int quality,
		       gboolean thumbnail,
		       ThumbnailSquareType squared_thumbnail_type);

/*
 *   get_image_sizes: retrieve image dimensions
 */
void get_image_sizes (const gchar *img,
                      unsigned long *width, unsigned long *height);

/*
 *   calculate_sizes: calculate maximal image sizes within specified limits keeping aspect ratio
 */
void calculate_sizes (const unsigned long max_width, const unsigned long max_height,
		      unsigned long *width, unsigned long *height);

/*
 *   modify_exif: - strip thumbnail stored in EXIF table
 *                - add copyright to Exif::Image::Copyright and Iptc::Application2::Copyright
 */
void modify_exif (const gchar *filename, gboolean strip_thumbnail, const gchar *add_copyright);


#ifdef __cplusplus
  }
#endif