-
Notifications
You must be signed in to change notification settings - Fork 47
/
heic-to-jpg-converter.html
297 lines (283 loc) · 12.2 KB
/
heic-to-jpg-converter.html
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
---
title: HEIC Image to JPG, JPEG, PNG or GIF Converter | Developer Tools
layout: post
---
<html>
<head>
<!-- Meta tags common for website -->
{% include common-meta %}
<title>{{ page.title }}</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<meta name="description"
content="This is easy to use open source tool convert HEIC Image to JPG, JPEG converter online. You can also use this to convert HEIC filese to other popular image formats like PNG." />
<meta name="keywords" content="online,tool,HEIC,JPG,JPEG,GIF,image,picture, PNG,convert,converter,web,opensource" />
<!-- CSS for the site theme -->
{% include theme-css %}
<!-- Annoying IE fixes -->
{% include ie-fixes %}
</head>
<body class="hold-transition skin-green sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<!-- header tag from theme -->
{% include theme-header %}
<!-- Sidebar for the whole website -->
{% include theme-sidebar %}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-6">
<div class="box box-success">
<div class="box-header with-border">
<h1 class="box-title">Convert HEIC Image To JPG, JPEG, PNG or GIF Format</h1>
</div>
<!-- /.box-header -->
<!-- form start -->
<div class="box-body">
<form role="form">
<div class="form-group">
<label for="myFile">Upload Image File From Your Computer</label>
<input type="file" id="myFile" name="filename">
</div>
<div class="form-group">
<label for="quality">Image Quality</label>
<select id="quality">
<option value="1" selected>Highest Quality [100% - Default]</option>
<option value="0.9">Reduce to 90%</option>
<option value="0.8">Reduce to 80%</option>
<option value="0.7">Reduce to 70%</option>
<option value="0.6">Reduce to 60%</option>
<option value="0.5">Reduce to 50%</option>
<option value="0.4">Reduce to 40%</option>
<option value="0.3">Reduce to 30%</option>
<option value="0.2">Reduce to 20%</option>
<option value="0.1">Reduce to 10% - Lowest Quality</option>
</select>
</div>
<div class="form-group">
<label for="format">Image Format</label>
<select id="format">
<option value="image/jpg" selected>JPG / JPEG</option>
<option value="image/png">PNG</option>
<option value="image/gif">GIF</option>
</select>
</div>
<div class="form-group">
<p id="error" class="text-red"></p>
</div>
</form>
</div>
<!-- /.box-body -->
<div class="box-footer">
<div class="row">
<div class="col-xs-3">
<button type="button" class="btn btn-info" id="convert">Convert<i
class="fa fa-fw fa-arrow-right"></i></button>
</div>
</div>
</div>
<!-- /.box-footer -->
</div>
</div>
<div class="col-md-6">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Download Your Converted Image From Here</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="form-group">
<label for="base64">Converted Image</label>
<div id="target"></div>
</div>
</div>
<div class="box-footer" id="download-div" style="display:none">
<div class="btn-group">
<a class="btn btn-info" target="_blank" id="download" href="#"> <i class="fa fa-download"></i> Download Converted File</a>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="content">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">About HEIC Image to JPG, JPEG, PNG and GIF Converter Tool</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<img class="img-responsive" src="images/heic-jpg.png"
alt="HEIC Image to JPG / JPEG / PNG / GIF Encoding format converter tool"
title="HEIC Image to JPG / JPEG / PNG / GIF Encoding format converter tool">
<p>This is a free online tool to convert a HEIC format image file into JPG format and other popular formats including JPEG and PNG. You can also use it to
convert to GIF formats.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">What Is HEIC Encoding Format?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>HEIC is a popular encoding format for images. It stands for High Efficiency Image Container. This format is used by recent iOS devices to store pictures.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Why Convert From HEIC Image to Other Format Encoding?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>HEIC image format is not commonly supported by browsers. Therefore it needs to be converted into a browswer friendly format before it can be displayed on a browser. </p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Can I convert a Live Photo to GIF?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>The iOS live phots are stored as HEIC format images. HEIC image format can easily be converted to GIF using this tool. Please select GIF format option in the tool. This is ideal option for LIVE photos from iOS devices. </p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Can I download converted photos?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>Yes, this tool is completely free to use. You can download converted images using the download button that appears after conversion.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Are my photos converted on client side or server side?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>This tool uses a client side only library to do conversion. Therefore the photos you upload never get transfered over internet.</p>
<p>This tool is a free to use and open source therefore we are not using any server side technology to convert or store photos.</p>
<p>Photos are not stored anywhere, so you need to convert them everytime you require it. </p>
<p>Only one conveted photo stays in browser memory so everytime you convert a photo the last photo will be lost.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Why is the image size so high after conversion?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>The HEIC image format quality is usually very high. This format is very efficient in storing images. However, when we convert it to other lower efficient formats the image size increases drastically.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">How to reduce converted image size?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>To reduce the size of image you must chose to lowe the quality. Please select quality option from menu to reduce the quality of converted image. Lower quality ==> Lower file size of image.</p>
</div>
<!-- /.box-body -->
</div>
</section>
{% include addthis %}
</div>
<!-- /.content-wrapper -->
{% include theme-footer %}
</div>
<!-- ./wrapper -->
{% include theme-bottom-js %}
</body>
<script src="/plugins/selectOnFocus/jquery.selectOnFocus.min.js"></script>
<script src="/javascripts/heic2any.min.js"></script>
<script>
const extensionsMap = new Map();
extensionsMap.set('image/jpg', 'jpg');
extensionsMap.set('image/png', 'png');
extensionsMap.set('image/gif', 'gif');
const findExtension = (context) => {
return (context.format) ? extensionsMap.get(context.format) || '' : '';
};
const showImage = (context) => {
$("#target").html(`<a target="_blank" download="${context.filename}" href="${context.url}"><img src="${context.url}"></a>`);
$('#download').attr('download', context.filename);
$('#download').attr('href', context.url);
$('#download-div').show();
};
const extractAfterLastIndexOf = (str, ch) => {
return (str && str.indexOf(ch) > 0)
? str.substr(str.lastIndexOf(ch) + 1) : '';
}
const getOriginalFileMeta = () => {
meta = {};
meta.filePath = $('#myFile').val() || '';
meta.fileName = extractAfterLastIndexOf(meta.filePath, '\\');
meta.fileExtension = extractAfterLastIndexOf(meta.fileName, '.');
return meta;
};
const showInProgress = () => {
$('#error').text('');
$("#target").html("<i class='fa fa-refresh fa-spin'></i> <p>Converting...</p>");
$('#download-div').hide();
};
const readFileAndConvert = (context) => {
showInProgress();
const filesSelected = document.getElementById('myFile').files;
context.convertedFileExtension = findExtension(context);
if (filesSelected
&& filesSelected.length > 0
&& context.originalFileMeta
&& context.originalFileMeta.fileExtension
&& context.originalFileMeta.fileExtension.toUpperCase() === 'HEIC'
&& context.format
&& context.convertedFileExtension) {
context.filename = `${context.originalFileMeta.fileName}.${context.convertedFileExtension}`;
context.blob = filesSelected[0];
convert(context);
} else {
$('#error').text('Invalid File, unable to convert');
$("#target").html('');
}
};
const convert = (context) => {
heic2any({
blob: context.blob,
toType: context.format,
quality: context.quality || 1
}).then(function (resultBlob) {
context.url = URL.createObjectURL(resultBlob);
context.callback(context);
}).catch(function (x) {
console.log(x.code);
console.log(x.message);
});
};
$(document).ready(function () {
$("#convert").click(function () {
const context = {};
context.format = $('#format option:selected').val();
context.quality = Number.parseFloat($('#quality option:selected').val()) || 1;
context.callback = showImage;
context.originalFileMeta = getOriginalFileMeta();
readFileAndConvert(context);
});
$("#myFile").selectOnFocus();
$("#base64").selectOnFocus();
$('#converters-category').addClass('active');
$('.markdown-body').attr('style', 'max-width:100%;');
});
</script>
</html>