mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 14:09:31 +02:00
chore: move from png to image-generic
This commit is contained in:
44
.idea/workspace.xml
generated
44
.idea/workspace.xml
generated
@@ -4,15 +4,23 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="chore: remove labels">
|
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="feat: svg change colors">
|
||||||
<change afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/change-colors/service.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/components/result/ToolFileResult.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/result/ToolFileResult.tsx" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/generic/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/index.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/generic/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/index.ts" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/change-colors-in-png/change-colors-in-png.e2e.spec.ts" beforeDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/change-opacity/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/change-opacity/index.tsx" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/change-colors-in-png/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/change-colors/index.tsx" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/change-opacity/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/change-opacity/meta.ts" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/change-colors-in-png/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/change-colors/meta.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/change-opacity/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/change-opacity/service.ts" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/change-colors-in-png/test.png" beforeDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/create-transparent/create-transparent.e2e.spec.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/create-transparent/create-transparent.e2e.spec.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/create-transparent/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/create-transparent/index.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/create-transparent/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/create-transparent/meta.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/create-transparent/test.png" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/create-transparent/test.png" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/crop/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/crop/index.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/crop/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/crop/meta.ts" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/png/index.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/png/index.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/remove-background/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/remove-background/index.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/tools/image/png/remove-background/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/image/generic/remove-background/meta.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/tools/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/tools/index.ts" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -407,15 +415,7 @@
|
|||||||
<workItem from="1743569964813" duration="352000" />
|
<workItem from="1743569964813" duration="352000" />
|
||||||
<workItem from="1743570403937" duration="109000" />
|
<workItem from="1743570403937" duration="109000" />
|
||||||
<workItem from="1743607343305" duration="20000" />
|
<workItem from="1743607343305" duration="20000" />
|
||||||
<workItem from="1743619618671" duration="3827000" />
|
<workItem from="1743619618671" duration="7027000" />
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00135" summary="feat: jakarta font">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1740665609483</created>
|
|
||||||
<option name="number" value="00135" />
|
|
||||||
<option name="presentableId" value="LOCAL-00135" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1740665609483</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00136" summary="chore: img">
|
<task id="LOCAL-00136" summary="chore: img">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -801,7 +801,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1743621602590</updated>
|
<updated>1743621602590</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="184" />
|
<task id="LOCAL-00184" summary="feat: svg change colors">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1743623617781</created>
|
||||||
|
<option name="number" value="00184" />
|
||||||
|
<option name="presentableId" value="LOCAL-00184" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1743623617781</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="185" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -848,7 +856,6 @@
|
|||||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
<option name="CHECK_NEW_TODO" value="false" />
|
<option name="CHECK_NEW_TODO" value="false" />
|
||||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||||
<MESSAGE value="fix: prettify json" />
|
|
||||||
<MESSAGE value="refactor: sum" />
|
<MESSAGE value="refactor: sum" />
|
||||||
<MESSAGE value="fix: tools by category scroll" />
|
<MESSAGE value="fix: tools by category scroll" />
|
||||||
<MESSAGE value="fix: missing meta" />
|
<MESSAGE value="fix: missing meta" />
|
||||||
@@ -873,7 +880,8 @@
|
|||||||
<MESSAGE value="docs: readme" />
|
<MESSAGE value="docs: readme" />
|
||||||
<MESSAGE value="feat: compress image" />
|
<MESSAGE value="feat: compress image" />
|
||||||
<MESSAGE value="chore: remove labels" />
|
<MESSAGE value="chore: remove labels" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="chore: remove labels" />
|
<MESSAGE value="feat: svg change colors" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="feat: svg change colors" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
@@ -52,8 +52,17 @@ export default function ToolFileResult({
|
|||||||
if (value) {
|
if (value) {
|
||||||
let filename: string = value.name;
|
let filename: string = value.name;
|
||||||
if (extension) {
|
if (extension) {
|
||||||
const hasExtension = filename.includes('.');
|
// Split at the last period to separate filename and extension
|
||||||
filename = hasExtension ? filename : `${filename}.${extension}`;
|
const parts = filename.split('.');
|
||||||
|
// If there's more than one part (meaning there was a period)
|
||||||
|
if (parts.length > 1) {
|
||||||
|
// Remove the last part (the extension) and add the new extension
|
||||||
|
parts.pop();
|
||||||
|
filename = `${parts.join('.')}.${extension}`;
|
||||||
|
} else {
|
||||||
|
// No extension exists, just add it
|
||||||
|
filename = `${filename}.${extension}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const blob = new Blob([value], { type: value.type });
|
const blob = new Blob([value], { type: value.type });
|
||||||
const url = window.URL.createObjectURL(blob);
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import ToolImageInput from '@components/input/ToolImageInput';
|
import ToolImageInput from '@components/input/ToolImageInput';
|
||||||
import ToolFileResult from '@components/result/ToolFileResult';
|
import ToolFileResult from '@components/result/ToolFileResult';
|
||||||
import { changeOpacity } from './service';
|
import { changeOpacity } from './service';
|
||||||
@@ -97,16 +97,12 @@ export default function ChangeOpacity({ title }: ToolComponentProps) {
|
|||||||
<ToolImageInput
|
<ToolImageInput
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
accept={['image/png']}
|
accept={['image/*']}
|
||||||
title={'Input PNG'}
|
title={'Input image'}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
<ToolFileResult
|
<ToolFileResult title={'Changed image'} value={result} />
|
||||||
title={'Changed PNG'}
|
|
||||||
value={result}
|
|
||||||
extension={'png'}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
// exampleCards={exampleCards}
|
// exampleCards={exampleCards}
|
13
src/pages/tools/image/generic/change-opacity/meta.ts
Normal file
13
src/pages/tools/image/generic/change-opacity/meta.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { defineTool } from '@tools/defineTool';
|
||||||
|
import { lazy } from 'react';
|
||||||
|
|
||||||
|
export const tool = defineTool('image-generic', {
|
||||||
|
name: 'Change image Opacity',
|
||||||
|
path: 'change-opacity',
|
||||||
|
icon: 'material-symbols:opacity',
|
||||||
|
description:
|
||||||
|
'Easily adjust the transparency of your images. Simply upload your image, use the slider to set the desired opacity level between 0 (fully transparent) and 1 (fully opaque), and download the modified image.',
|
||||||
|
shortDescription: 'Adjust transparency of images',
|
||||||
|
keywords: ['opacity', 'transparency', 'png', 'alpha', 'jpg', 'jpeg', 'image'],
|
||||||
|
component: lazy(() => import('./index'))
|
||||||
|
});
|
@@ -9,7 +9,10 @@ interface OpacityOptions {
|
|||||||
areaHeight: number;
|
areaHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function changeOpacity(file: File, options: OpacityOptions): Promise<File> {
|
export async function changeOpacity(
|
||||||
|
file: File,
|
||||||
|
options: OpacityOptions
|
||||||
|
): Promise<File> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = (event) => {
|
reader.onload = (event) => {
|
||||||
@@ -32,12 +35,12 @@ export async function changeOpacity(file: File, options: OpacityOptions): Promis
|
|||||||
|
|
||||||
canvas.toBlob((blob) => {
|
canvas.toBlob((blob) => {
|
||||||
if (blob) {
|
if (blob) {
|
||||||
const newFile = new File([blob], file.name, { type: 'image/png' });
|
const newFile = new File([blob], file.name, { type: file.type });
|
||||||
resolve(newFile);
|
resolve(newFile);
|
||||||
} else {
|
} else {
|
||||||
reject(new Error('Failed to generate image blob'));
|
reject(new Error('Failed to generate image blob'));
|
||||||
}
|
}
|
||||||
}, 'image/png');
|
}, file.type);
|
||||||
};
|
};
|
||||||
img.onerror = () => reject(new Error('Failed to load image'));
|
img.onerror = () => reject(new Error('Failed to load image'));
|
||||||
img.src = event.target?.result as string;
|
img.src = event.target?.result as string;
|
||||||
@@ -67,7 +70,8 @@ function applyGradientOpacity(
|
|||||||
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||||
ctx.drawImage(img, 0, 0);
|
ctx.drawImage(img, 0, 0);
|
||||||
|
|
||||||
const gradient = options.gradientType === 'linear'
|
const gradient =
|
||||||
|
options.gradientType === 'linear'
|
||||||
? createLinearGradient(ctx, options)
|
? createLinearGradient(ctx, options)
|
||||||
: createRadialGradient(ctx, options);
|
: createRadialGradient(ctx, options);
|
||||||
|
|
@@ -5,7 +5,7 @@ import Jimp from 'jimp';
|
|||||||
|
|
||||||
test.describe('Create transparent PNG', () => {
|
test.describe('Create transparent PNG', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto('/png/create-transparent');
|
await page.goto('/image-generic/create-transparent');
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO check why failing
|
//TODO check why failing
|
@@ -112,8 +112,8 @@ export default function CreateTransparent({ title }: ToolComponentProps) {
|
|||||||
<ToolImageInput
|
<ToolImageInput
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
accept={['image/png']}
|
accept={['image/*']}
|
||||||
title={'Input PNG'}
|
title={'Input image'}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
@@ -131,7 +131,7 @@ export default function CreateTransparent({ title }: ToolComponentProps) {
|
|||||||
toolInfo={{
|
toolInfo={{
|
||||||
title: 'Create Transparent PNG',
|
title: 'Create Transparent PNG',
|
||||||
description:
|
description:
|
||||||
'This tool allows you to make specific colors in a PNG image transparent. You can select the color to replace and adjust the similarity threshold to include similar colors.'
|
'This tool allows you to make specific colors in an image transparent. You can select the color to replace and adjust the similarity threshold to include similar colors.'
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
@@ -1,13 +1,13 @@
|
|||||||
import { defineTool } from '@tools/defineTool';
|
import { defineTool } from '@tools/defineTool';
|
||||||
import { lazy } from 'react';
|
import { lazy } from 'react';
|
||||||
|
|
||||||
export const tool = defineTool('png', {
|
export const tool = defineTool('image-generic', {
|
||||||
name: 'Create transparent PNG',
|
name: 'Create transparent PNG',
|
||||||
path: 'create-transparent',
|
path: 'create-transparent',
|
||||||
icon: 'mdi:circle-transparent',
|
icon: 'mdi:circle-transparent',
|
||||||
shortDescription: 'Quickly make a PNG image transparent',
|
shortDescription: 'Quickly make an image transparent',
|
||||||
description:
|
description:
|
||||||
"World's simplest online Portable Network Graphics transparency maker. Just import your PNG image in the editor on the left and you will instantly get a transparent PNG on the right. Free, quick, and very powerful. Import a PNG – get a transparent PNG.",
|
"World's simplest online Portable Network Graphics transparency maker. Just import your image in the editor on the left and you will instantly get a transparent PNG on the right. Free, quick, and very powerful. Import an image – get a transparent PNG.",
|
||||||
keywords: ['create', 'transparent'],
|
keywords: ['create', 'transparent'],
|
||||||
component: lazy(() => import('./index'))
|
component: lazy(() => import('./index'))
|
||||||
});
|
});
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
@@ -32,7 +32,7 @@ const validationSchema = Yup.object({
|
|||||||
.required('Height is required')
|
.required('Height is required')
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function CropPng({ title }: ToolComponentProps) {
|
export default function CropImage({ title }: ToolComponentProps) {
|
||||||
const [input, setInput] = useState<File | null>(null);
|
const [input, setInput] = useState<File | null>(null);
|
||||||
const [result, setResult] = useState<File | null>(null);
|
const [result, setResult] = useState<File | null>(null);
|
||||||
|
|
||||||
@@ -101,11 +101,11 @@ export default function CropPng({ title }: ToolComponentProps) {
|
|||||||
destCanvas.toBlob((blob) => {
|
destCanvas.toBlob((blob) => {
|
||||||
if (blob) {
|
if (blob) {
|
||||||
const newFile = new File([blob], file.name, {
|
const newFile = new File([blob], file.name, {
|
||||||
type: 'image/png'
|
type: file.type
|
||||||
});
|
});
|
||||||
setResult(newFile);
|
setResult(newFile);
|
||||||
}
|
}
|
||||||
}, 'image/png');
|
}, file.type);
|
||||||
};
|
};
|
||||||
|
|
||||||
processImage(input, x, y, width, height, isCircular);
|
processImage(input, x, y, width, height, isCircular);
|
||||||
@@ -180,13 +180,13 @@ export default function CropPng({ title }: ToolComponentProps) {
|
|||||||
<SimpleRadio
|
<SimpleRadio
|
||||||
onClick={() => updateField('cropShape', 'rectangular')}
|
onClick={() => updateField('cropShape', 'rectangular')}
|
||||||
checked={values.cropShape == 'rectangular'}
|
checked={values.cropShape == 'rectangular'}
|
||||||
description={'Crop a rectangular fragment from a PNG.'}
|
description={'Crop a rectangular fragment from an image.'}
|
||||||
title={'Rectangular Crop Shape'}
|
title={'Rectangular Crop Shape'}
|
||||||
/>
|
/>
|
||||||
<SimpleRadio
|
<SimpleRadio
|
||||||
onClick={() => updateField('cropShape', 'circular')}
|
onClick={() => updateField('cropShape', 'circular')}
|
||||||
checked={values.cropShape == 'circular'}
|
checked={values.cropShape == 'circular'}
|
||||||
description={'Crop a circular fragment from a PNG.'}
|
description={'Crop a circular fragment from an image.'}
|
||||||
title={'Circular Crop Shape'}
|
title={'Circular Crop Shape'}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -200,8 +200,8 @@ export default function CropPng({ title }: ToolComponentProps) {
|
|||||||
<ToolImageInput
|
<ToolImageInput
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
accept={['image/png']}
|
accept={['image/*']}
|
||||||
title={'Input PNG'}
|
title={'Input image'}
|
||||||
showCropOverlay={!!input}
|
showCropOverlay={!!input}
|
||||||
cropShape={values.cropShape as 'rectangular' | 'circular'}
|
cropShape={values.cropShape as 'rectangular' | 'circular'}
|
||||||
cropPosition={{
|
cropPosition={{
|
||||||
@@ -225,16 +225,12 @@ export default function CropPng({ title }: ToolComponentProps) {
|
|||||||
validationSchema={validationSchema}
|
validationSchema={validationSchema}
|
||||||
renderCustomInput={renderCustomInput}
|
renderCustomInput={renderCustomInput}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
<ToolFileResult
|
<ToolFileResult title={'Cropped image'} value={result} />
|
||||||
title={'Cropped PNG'}
|
|
||||||
value={result}
|
|
||||||
extension={'png'}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
toolInfo={{
|
toolInfo={{
|
||||||
title: 'Crop PNG Image',
|
title: 'Crop Image',
|
||||||
description:
|
description:
|
||||||
'This tool allows you to crop a PNG image by specifying the position, size, and shape of the crop area. You can choose between rectangular or circular cropping.'
|
'This tool allows you to crop an image by specifying the position, size, and shape of the crop area. You can choose between rectangular or circular cropping.'
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
@@ -1,7 +1,7 @@
|
|||||||
import { defineTool } from '@tools/defineTool';
|
import { defineTool } from '@tools/defineTool';
|
||||||
import { lazy } from 'react';
|
import { lazy } from 'react';
|
||||||
|
|
||||||
export const tool = defineTool('png', {
|
export const tool = defineTool('image-generic', {
|
||||||
name: 'Crop',
|
name: 'Crop',
|
||||||
path: 'crop',
|
path: 'crop',
|
||||||
icon: 'mdi:crop', // Iconify icon as a string
|
icon: 'mdi:crop', // Iconify icon as a string
|
@@ -1,5 +1,17 @@
|
|||||||
import { tool as resizeImage } from './resize/meta';
|
import { tool as resizeImage } from './resize/meta';
|
||||||
import { tool as compressImage } from './compress/meta';
|
import { tool as compressImage } from './compress/meta';
|
||||||
import { tool as changeColors } from './change-colors/meta';
|
import { tool as changeColors } from './change-colors/meta';
|
||||||
|
import { tool as removeBackground } from './remove-background/meta';
|
||||||
|
import { tool as cropImage } from './crop/meta';
|
||||||
|
import { tool as changeOpacity } from './change-opacity/meta';
|
||||||
|
import { tool as createTransparent } from './create-transparent/meta';
|
||||||
|
|
||||||
export const imageGenericTools = [resizeImage, compressImage, changeColors];
|
export const imageGenericTools = [
|
||||||
|
resizeImage,
|
||||||
|
compressImage,
|
||||||
|
removeBackground,
|
||||||
|
cropImage,
|
||||||
|
changeOpacity,
|
||||||
|
changeColors,
|
||||||
|
createTransparent
|
||||||
|
];
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import { Box, CircularProgress, Typography } from '@mui/material';
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import ToolFileResult from '@components/result/ToolFileResult';
|
import ToolFileResult from '@components/result/ToolFileResult';
|
||||||
@@ -11,7 +10,9 @@ const initialValues = {};
|
|||||||
|
|
||||||
const validationSchema = Yup.object({});
|
const validationSchema = Yup.object({});
|
||||||
|
|
||||||
export default function RemoveBackgroundFromPng({ title }: ToolComponentProps) {
|
export default function RemoveBackgroundFromImage({
|
||||||
|
title
|
||||||
|
}: ToolComponentProps) {
|
||||||
const [input, setInput] = useState<File | null>(null);
|
const [input, setInput] = useState<File | null>(null);
|
||||||
const [result, setResult] = useState<File | null>(null);
|
const [result, setResult] = useState<File | null>(null);
|
||||||
const [isProcessing, setIsProcessing] = useState<boolean>(false);
|
const [isProcessing, setIsProcessing] = useState<boolean>(false);
|
||||||
@@ -64,7 +65,7 @@ export default function RemoveBackgroundFromPng({ title }: ToolComponentProps) {
|
|||||||
<ToolImageInput
|
<ToolImageInput
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
accept={['image/png', 'image/jpeg', 'image/jpg']}
|
accept={['image/*']}
|
||||||
title={'Input Image'}
|
title={'Input Image'}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -78,7 +79,7 @@ export default function RemoveBackgroundFromPng({ title }: ToolComponentProps) {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
toolInfo={{
|
toolInfo={{
|
||||||
title: 'Remove Background from PNG',
|
title: 'Remove Background from Image',
|
||||||
description:
|
description:
|
||||||
'This tool uses AI to automatically remove the background from your images, creating a transparent PNG. Perfect for product photos, profile pictures, and design assets.'
|
'This tool uses AI to automatically remove the background from your images, creating a transparent PNG. Perfect for product photos, profile pictures, and design assets.'
|
||||||
}}
|
}}
|
21
src/pages/tools/image/generic/remove-background/meta.ts
Normal file
21
src/pages/tools/image/generic/remove-background/meta.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { defineTool } from '@tools/defineTool';
|
||||||
|
import { lazy } from 'react';
|
||||||
|
|
||||||
|
export const tool = defineTool('image-generic', {
|
||||||
|
name: 'Remove Background from Image',
|
||||||
|
path: 'remove-background',
|
||||||
|
icon: 'mdi:image-remove',
|
||||||
|
description:
|
||||||
|
"World's simplest online tool to remove backgrounds from images. Just upload your image and our AI-powered tool will automatically remove the background, giving you a transparent PNG. Perfect for product photos, profile pictures, and design assets.",
|
||||||
|
shortDescription: 'Automatically remove backgrounds from images',
|
||||||
|
keywords: [
|
||||||
|
'remove',
|
||||||
|
'background',
|
||||||
|
'png',
|
||||||
|
'transparent',
|
||||||
|
'image',
|
||||||
|
'ai',
|
||||||
|
'jpg'
|
||||||
|
],
|
||||||
|
component: lazy(() => import('./index'))
|
||||||
|
});
|
@@ -1,12 +0,0 @@
|
|||||||
import { defineTool } from '@tools/defineTool';
|
|
||||||
import { lazy } from 'react';
|
|
||||||
|
|
||||||
export const tool = defineTool('png', {
|
|
||||||
name: 'Change PNG Opacity',
|
|
||||||
path: 'change-opacity',
|
|
||||||
icon: 'material-symbols:opacity',
|
|
||||||
description: 'Easily adjust the transparency of your PNG images. Simply upload your PNG file, use the slider to set the desired opacity level between 0 (fully transparent) and 1 (fully opaque), and download the modified image.',
|
|
||||||
shortDescription: 'Adjust transparency of PNG images',
|
|
||||||
keywords: ['opacity', 'transparency', 'png', 'alpha'],
|
|
||||||
component: lazy(() => import('./index'))
|
|
||||||
});
|
|
@@ -1,15 +1,4 @@
|
|||||||
import { tool as pngCrop } from './crop/meta';
|
|
||||||
import { tool as pngCompressPng } from './compress-png/meta';
|
import { tool as pngCompressPng } from './compress-png/meta';
|
||||||
import { tool as convertJgpToPng } from './convert-jgp-to-png/meta';
|
import { tool as convertJgpToPng } from './convert-jgp-to-png/meta';
|
||||||
import { tool as pngCreateTransparent } from './create-transparent/meta';
|
|
||||||
import { tool as changeOpacity } from './change-opacity/meta';
|
|
||||||
import { tool as removeBackground } from './remove-background/meta';
|
|
||||||
|
|
||||||
export const pngTools = [
|
export const pngTools = [pngCompressPng, convertJgpToPng];
|
||||||
pngCompressPng,
|
|
||||||
pngCreateTransparent,
|
|
||||||
convertJgpToPng,
|
|
||||||
changeOpacity,
|
|
||||||
pngCrop,
|
|
||||||
removeBackground
|
|
||||||
];
|
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
import { defineTool } from '@tools/defineTool';
|
|
||||||
import { lazy } from 'react';
|
|
||||||
|
|
||||||
export const tool = defineTool('png', {
|
|
||||||
name: 'Remove Background from PNG',
|
|
||||||
path: 'remove-background',
|
|
||||||
icon: 'mdi:image-remove',
|
|
||||||
description:
|
|
||||||
"World's simplest online tool to remove backgrounds from PNG images. Just upload your image and our AI-powered tool will automatically remove the background, giving you a transparent PNG. Perfect for product photos, profile pictures, and design assets.",
|
|
||||||
shortDescription: 'Automatically remove backgrounds from images',
|
|
||||||
keywords: ['remove', 'background', 'png', 'transparent', 'image', 'ai'],
|
|
||||||
component: lazy(() => import('./index'))
|
|
||||||
});
|
|
@@ -13,7 +13,7 @@ import { IconifyIcon } from '@iconify/react';
|
|||||||
import { pdfTools } from '../pages/tools/pdf';
|
import { pdfTools } from '../pages/tools/pdf';
|
||||||
|
|
||||||
const toolCategoriesOrder: ToolCategory[] = [
|
const toolCategoriesOrder: ToolCategory[] = [
|
||||||
'png',
|
'image-generic',
|
||||||
'string',
|
'string',
|
||||||
'json',
|
'json',
|
||||||
'pdf',
|
'pdf',
|
||||||
@@ -21,9 +21,9 @@ const toolCategoriesOrder: ToolCategory[] = [
|
|||||||
'csv',
|
'csv',
|
||||||
'video',
|
'video',
|
||||||
'number',
|
'number',
|
||||||
'gif',
|
'png',
|
||||||
'time',
|
'time',
|
||||||
'image-generic'
|
'gif'
|
||||||
];
|
];
|
||||||
export const tools: DefinedTool[] = [
|
export const tools: DefinedTool[] = [
|
||||||
...imageTools,
|
...imageTools,
|
||||||
|
Reference in New Issue
Block a user