Skip to content

Commit b33fbe8

Browse files
authored
Merge pull request #4 from utmp/main
more image formats
2 parents 5c45881 + 17f164e commit b33fbe8

7 files changed

Lines changed: 747 additions & 21 deletions

File tree

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

electron-builder.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
appId: com.electron.app
2-
productName: yeni
1+
appId: com.openconvert.app
2+
productName: openconvert
33
directories:
44
buildResources: build
55
files:
@@ -13,12 +13,16 @@ asarUnpack:
1313
- "**/node_modules/sharp/**/*"
1414
- "**/node_modules/@img/**/*"
1515
win:
16-
executableName: yeni
16+
executableName: openconvert
17+
icon: '/resources/logo.ico'
1718
nsis:
19+
oneClick: false
1820
artifactName: ${name}-${version}-setup.${ext}
1921
shortcutName: ${productName}
2022
uninstallDisplayName: ${productName}
2123
createDesktopShortcut: always
24+
allowToChangeInstallationDirectory: true
25+
license: LICENSE
2226
mac:
2327
entitlementsInherit: build/entitlements.mac.plist
2428
extendInfo:
@@ -34,7 +38,7 @@ linux:
3438
- AppImage
3539
- snap
3640
- deb
37-
maintainer: electronjs.org
41+
maintainer: openconvert
3842
category: Utility
3943
appImage:
4044
artifactName: ${name}-${version}.${ext}

resources/logo.ico

194 KB
Binary file not shown.

src/main/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ ipcMain.handle('process:image', async (_, { filepath, name, options, savePath })
8787
pipeline = pipeline.png({ quality: options.quality });
8888
} else if (options.format === 'avif') {
8989
pipeline = pipeline.avif({ quality: options.quality });
90+
}else if (options.format === 'tiff') {
91+
pipeline = pipeline.tiff({ quality: options.quality });
92+
}else if (options.format === 'heif') {
93+
pipeline = pipeline.heif({ quality: options.quality });
94+
}else if (options.format === 'jxl') {
95+
pipeline = pipeline.jxl({ quality: options.quality });
96+
}
97+
98+
// control if output type is tile
99+
if(options.format === 'tile'){
100+
options.format = 'zip'
90101
}
91102

92103
// Generate output filename

src/renderer/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<title>OpenConvert</title>
1111
</head>
1212
<body
13-
class="bg-[#222831] border border-solid border-transparent h-full m-0 overflow-hidden"
13+
class="bg-background border border-solid border-transparent h-full m-0 overflow-hidden"
1414
>
1515

1616
<div id="app"></div>

src/renderer/src/assets/main.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
@theme{
55
--color-midnight:#191e24;
6+
--color-background : #222831;
67
}

src/renderer/src/components/Upload.vue

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -219,18 +219,53 @@ async function processFiles() {
219219
}
220220
221221
// process one
222-
async function processOne(){
223-
if(files.value.length === 0) return;
224-
isProcessing.value = true
225-
processedFiles.value = []
226-
try {
227-
228-
} catch (error) {
229-
230-
}finally{
231-
isProcessing.value = false
232-
}
233-
}
222+
//async function processOne(index){
223+
// try {
224+
// processedFiles.value=[index]
225+
// isProcessing.value = true
226+
// // Ask user for save directory
227+
// const savePath = await ipcRenderer.invoke('dialog:selectDirectory')
228+
// if (!savePath) {
229+
// isProcessing.value = false
230+
// return // User cancelled
231+
// }
232+
// const file = files.value[index]
233+
// const filepath = files.value[index].path
234+
// const options = fileOptions.value[index]
235+
// const preview = previewUrls.value[index]
236+
// if (!file.type.startsWith('image/')) {
237+
// processedFiles.value.push({
238+
// name: file.name,
239+
// success: false,
240+
// message: 'Only image files can be processed'
241+
// })
242+
// }
243+
// // console.log(filepath)
244+
// // Send to main process for processing with Sharp
245+
// const result = await ipcRenderer.invoke('process:image', {
246+
// filepath,
247+
// name: file.name,
248+
// options: {
249+
// width: options.width,
250+
// height: options.height,
251+
// quality: options.quality,
252+
// format: options.format
253+
// },
254+
// savePath
255+
// });
256+
// console.log(result)
257+
// processedFiles.value[index] = {
258+
// name: file.name,
259+
// success: result.success,
260+
// message: result.message,
261+
// outputPath: result.outputPath
262+
// }
263+
// } catch (error) {
264+
// console.error('Error processing files:', error)
265+
// } finally {
266+
// isProcessing.value = false
267+
// }
268+
// }
234269
onMounted(() => {
235270
const dropArea = document.querySelector('.drop-area')
236271
const folderIcon = document.querySelector('.folder-icon')
@@ -332,7 +367,7 @@ onMounted(() => {
332367
<div
333368
v-for="(preview, index) in previewUrls"
334369
:key="index"
335-
class=" p-4 flex relative m-4 items-center gap-4 border-5 border-midnight rounded-lg hover:border-indigo-500"
370+
class=" p-4 flex relative m-4 items-center gap-4 border-5 border-midnight rounded-lg hover:border-indigo-500 group"
336371
>
337372
<!-- Image preview -->
338373
<div class="flex-shrink-0">
@@ -424,7 +459,10 @@ onMounted(() => {
424459
</div>
425460
</div>
426461
<!-- Buttons -->
427-
<div class="flex-shrink-0 flex flex-col gap-5 ml-auto">
462+
<button class="hidden group-hover:flex btn btn-sm btn-circle absolute right-2 top-0.5 text-gray-400 hover:bg-transparent hover:text-red-400 hover:border-red-400"
463+
@click="removeFile(index)"
464+
>✕</button>
465+
<div class="flex-shrink-0 flex flex-col gap-5 ml-auto pt-2">
428466
<button
429467
class="btn btn-sm btn-primary"
430468
:onclick="`document.getElementById('options_modal_${index}').showModal()`"
@@ -462,12 +500,10 @@ onMounted(() => {
462500
<option value="jpeg">JPEG</option>
463501
<option value="avif">AVIF</option>
464502
<option value="gif">GIF</option>
465-
<option value="jp2">JP2</option>
466503
<option value="tiff">TIFF</option>
467504
<option value="heif">HEIF</option>
468505
<option value="jxl">JXL</option>
469506
<option value="tile">Tile</option>
470-
<option value="raw">Raw (base64)</option>
471507
</select>
472508
</div>
473509

0 commit comments

Comments
 (0)