diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e85cecc..c5fd94f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,11 +4,13 @@
-
-
-
+
-
+
+
+
+
+
@@ -399,15 +401,7 @@
-
-
-
-
- 1740661424202
-
-
-
- 1740661424202
+
@@ -793,7 +787,15 @@
1743565606951
-
+
+
+ 1743566704552
+
+
+
+ 1743566704552
+
+
@@ -840,7 +842,6 @@
-
@@ -865,7 +866,8 @@
-
+
+
diff --git a/src/components/ToolHeader.tsx b/src/components/ToolHeader.tsx
index 4db6369..148289c 100644
--- a/src/components/ToolHeader.tsx
+++ b/src/components/ToolHeader.tsx
@@ -5,6 +5,7 @@ import { capitalizeFirstLetter } from '../utils/string';
import Grid from '@mui/material/Grid';
import { Icon, IconifyIcon } from '@iconify/react';
import { categoriesColors } from '../config/uiConfig';
+import { getToolsByCategory } from '@tools/index';
const StyledButton = styled(Button)(({ theme }) => ({
backgroundColor: 'white',
@@ -70,7 +71,9 @@ export default function ToolHeader({
items={[
{ title: 'All tools', link: '/' },
{
- title: capitalizeFirstLetter(type),
+ title: getToolsByCategory().find(
+ (category) => category.type === type
+ )!.rawTitle,
link: '/categories/' + type
},
{ title }
diff --git a/src/components/ToolLayout.tsx b/src/components/ToolLayout.tsx
index fb7caef..3dc1db0 100644
--- a/src/components/ToolLayout.tsx
+++ b/src/components/ToolLayout.tsx
@@ -53,7 +53,10 @@ export default function ToolLayout({
{children}
category.type === type)!
+ .rawTitle
+ )} tools`}
toolCards={otherCategoryTools}
/>
diff --git a/src/pages/tools-by-category/index.tsx b/src/pages/tools-by-category/index.tsx
index 33a0d9f..2aa1225 100644
--- a/src/pages/tools-by-category/index.tsx
+++ b/src/pages/tools-by-category/index.tsx
@@ -43,10 +43,11 @@ export default function Home() {
navigate('/')}>
- {`All ${capitalizeFirstLetter(categoryName)} Tools`}
+ {`All ${
+ getToolsByCategory().find(
+ (category) => category.type === categoryName
+ )!.rawTitle
+ } Tools`}
{getToolsByCategory()
diff --git a/src/pages/tools/image/generic/resize/service.ts b/src/pages/tools/image/generic/resize/service.ts
index 9b5914d..00f4f7a 100644
--- a/src/pages/tools/image/generic/resize/service.ts
+++ b/src/pages/tools/image/generic/resize/service.ts
@@ -1,4 +1,6 @@
import { InitialValuesType } from './types';
+import { FFmpeg } from '@ffmpeg/ffmpeg';
+import { fetchFile, toBlobURL } from '@ffmpeg/util';
export const processImage = async (
file: File,
@@ -97,6 +99,60 @@ export const processImage = async (
console.error('Error processing SVG:', error);
// Fall back to canvas method if SVG processing fails
}
+ } else if (file.type === 'image/gif') {
+ try {
+ const ffmpeg = new FFmpeg();
+
+ await ffmpeg.load({
+ wasmURL:
+ 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.9/dist/esm/ffmpeg-core.wasm'
+ });
+
+ // Write the input file to memory
+ await ffmpeg.writeFile('input.gif', await fetchFile(file));
+
+ // Calculate new dimensions
+ let newWidth = 0;
+ let newHeight = 0;
+ let scaleFilter = '';
+
+ if (resizeMethod === 'pixels') {
+ if (dimensionType === 'width') {
+ newWidth = parseInt(width);
+ if (maintainAspectRatio) {
+ scaleFilter = `scale=${newWidth}:-1`;
+ } else {
+ newHeight = parseInt(height);
+ scaleFilter = `scale=${newWidth}:${newHeight}`;
+ }
+ } else {
+ // height
+ newHeight = parseInt(height);
+ if (maintainAspectRatio) {
+ scaleFilter = `scale=-1:${newHeight}`;
+ } else {
+ newWidth = parseInt(width);
+ scaleFilter = `scale=${newWidth}:${newHeight}`;
+ }
+ }
+ } else {
+ // percentage
+ const scale = parseInt(percentage) / 100;
+ scaleFilter = `scale=iw*${scale}:ih*${scale}`;
+ }
+
+ // Run FFmpeg command
+ await ffmpeg.exec(['-i', 'input.gif', '-vf', scaleFilter, 'output.gif']);
+
+ // Read the output file
+ const data = await ffmpeg.readFile('output.gif');
+
+ // Create a new File object
+ return new File([data], file.name, { type: 'image/gif' });
+ } catch (error) {
+ console.error('Error processing GIF with FFmpeg:', error);
+ // Fall back to canvas method if FFmpeg processing fails
+ }
}
// Create canvas
const canvas = document.createElement('canvas');
diff --git a/src/tools/index.ts b/src/tools/index.ts
index f51e8e3..3ca189a 100644
--- a/src/tools/index.ts
+++ b/src/tools/index.ts
@@ -130,6 +130,7 @@ export const filterTools = (
export const getToolsByCategory = (): {
title: string;
+ rawTitle: string;
description: string;
icon: IconifyIcon | string;
type: string;
@@ -144,6 +145,7 @@ export const getToolsByCategory = (): {
(config) => config.type === type
);
return {
+ rawTitle: categoryConfig?.title ?? capitalizeFirstLetter(type),
title: `${categoryConfig?.title ?? capitalizeFirstLetter(type)} Tools`,
description: categoryConfig?.value ?? '',
type,