-
Notifications
You must be signed in to change notification settings - Fork 0
merge 1.0.12 #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge 1.0.12 #132
Conversation
1. toPIX --> toPix 2. toSharpBuffer --> toSharp
"PIX" to "Pix"
Co-authored-by: volta2030 <65960990+volta2030@users.noreply.github.com>
…-functionality Add HEIF/HEIC image format support
update pegasus app image
Co-authored-by: volta2030 <65960990+volta2030@users.noreply.github.com>
Co-authored-by: volta2030 <65960990+volta2030@users.noreply.github.com>
…r-rotation Add rotating dotted border effect during image drag-and-drop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR merges version 1.0.12, which adds support for new image formats (PIX, HEIF, HEIC), enhances the pad feature with configurable background color, refactors color picker functionality, and adds visual feedback for drag-and-drop operations.
- Added PIX format support with custom JSON-based image data structure
- Enhanced pad feature to accept custom background colors
- Moved color name resolution from renderer to main process for better architecture
- Added animated border effect during drag-and-drop operations
- Added HEIF/HEIC format support
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Version bump to 1.0.12 and added jsonfile dependency |
| package-lock.json | Dependency updates including jsonfile hoisting and minor version bumps for electron, glob, and form-data |
| imgkit/core/pix.js | New module for PIX format handling with read/write/conversion methods |
| imgkit/processing/image_loader.js | Added PIX format loading support in openImage, openFromBuffer, getImageLoader, and getBufferLoader |
| imgkit/processing/format_converter.js | Added conversion methods for PIX and HEIF/HEIC formats |
| imgkit/core/image_layer.js | Added PIX format save logic |
| imgkit/processing/image_processor.js | (Context) Contains getColorName method used in color picker refactoring |
| main.js | Refactored color picker to compute color names in main process; added HEIF/HEIC/PIX to file dialog filters; renamed cropImgREQ to rectCropImgREQ |
| renderer/paint_renderer.js | Added padColor variable and event listener for color input |
| renderer/main_renderer.js | Updated padImgCMD handler to accept color parameter |
| renderer/crop_renderer.js | Added rectCropBtn click handler |
| pages/paint_panel.html | Added UI elements for pad color selection |
| pages/crop_panel.html | Added rectCrop button |
| imgkit/index.html | Added PIX, HEIF, and HEIC format options to extension dropdown |
| imgkit/imgpanel.css | Added rotating border animation for drag-over state |
| css/paint_panel.css | Added styles for padColorBox and padColorValue |
| imgkit/features/image_layer_events.js | Refactored color picker to send color without name; added drag-border-active animation class management; added clipboard write for color palette clicks |
| imgkit/core/main_renderer.js | Formatting adjustment for ternary operator |
| assets/pix.pix | Sample PIX format file with metadata |
| README.md | Updated supported file extensions list and screenshot |
| PRIVACYPOLICY.md | Removed privacy policy file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <input id="padValue" type="number" min="1" value="1" step="1" /> | ||
| <div id="padColorBox"></div> | ||
| <div id="padIndicator"> | ||
| <input id="padColorValue" type="text" value="#000000" /> |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using type="color" instead of type="text" for the padColorValue input to provide a native color picker UI and ensure valid color values are entered.
| <input id="padColorValue" type="text" value="#000000" /> | |
| <input id="padColorValue" type="color" value="#000000" /> |
imgkit/processing/image_loader.js
Outdated
| if (extension == "pix") { | ||
| const pixData = Pix.open(filepath); | ||
| return Pix.toSharp(pixData); | ||
| } |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The methods getImageLoader and getBufferLoader both call Pix.toSharp() but don't handle the case where it returns null (which can happen if the PIX data is invalid). This could cause issues downstream. Consider adding error handling or validation.
| if (raw.length < expectedLength) raw.fill(0, raw.length, expectedLength); | ||
|
|
||
| return sharp(raw, { |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buffer filling logic may not work correctly when raw.length < expectedLength. Using fill() on the existing buffer doesn't extend it. Consider using Buffer.concat([raw, Buffer.alloc(expectedLength - raw.length)]) to properly pad the buffer to the expected length.
| if (raw.length < expectedLength) raw.fill(0, raw.length, expectedLength); | |
| return sharp(raw, { | |
| const paddedRaw = raw.length < expectedLength | |
| ? Buffer.concat([raw, Buffer.alloc(expectedLength - raw.length)]) | |
| : raw; | |
| return sharp(paddedRaw, { |
| const pngResult = await Pix.toSharp(pixData); | ||
|
|
||
| return { buffer: pngResult.data, info: metadata }; |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The convertToPix method converts an image to PIX format and then immediately converts it back to PNG via Pix.toSharp(). This defeats the purpose of format conversion. The method should return the PIX data buffer (e.g., JSON.stringify(pixData)) instead of converting it back to PNG. Consider: return { buffer: Buffer.from(JSON.stringify(pixData, null, 2)), info: metadata };
| const pngResult = await Pix.toSharp(pixData); | |
| return { buffer: pngResult.data, info: metadata }; | |
| return { buffer: Buffer.from(JSON.stringify(pixData, null, 2)), info: metadata }; |
| document.getElementById("padColorValue").addEventListener("input", (event) => { | ||
| padColor = event.target.value; | ||
| document.getElementById("padColorBox").style.backgroundColor = padColor; |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The padColor input lacks validation. Consider adding validation to ensure the value is a valid hex color (e.g., using a regex like /^#[0-9A-Fa-f]{6}$/) before using it. Invalid color values could cause issues with the Sharp library's extend operation.
imgkit/processing/image_loader.js
Outdated
| if (extension == "pix") { | ||
| const pixData = Pix.openFromBuffer(buffer); | ||
| return Pix.toSharp(pixData); | ||
| } |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The methods getImageLoader and getBufferLoader both call Pix.toSharp() but don't handle the case where it returns null (which can happen if the PIX data is invalid). This could cause issues downstream. Consider adding error handling or validation.
| static async toPix(buffer, info) { | ||
| const { data, info: rawInfo } = await sharp(buffer) |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable rawInfo.
| static async toPix(buffer, info) { | |
| const { data, info: rawInfo } = await sharp(buffer) | |
| static async toPix(buffer) { | |
| const { data, info } = await sharp(buffer) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.