Skip to content

Conversation

@volta2030
Copy link
Member

No description provided.

volta2030 and others added 28 commits November 16, 2025 19:17
1. toPIX --> toPix
2. toSharpBuffer --> toSharp
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
Copy link
Contributor

Copilot AI left a 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" />
Copy link

Copilot AI Dec 7, 2025

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.

Suggested change
<input id="padColorValue" type="text" value="#000000" />
<input id="padColorValue" type="color" value="#000000" />

Copilot uses AI. Check for mistakes.
Comment on lines 107 to 110
if (extension == "pix") {
const pixData = Pix.open(filepath);
return Pix.toSharp(pixData);
}
Copy link

Copilot AI Dec 7, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +44
if (raw.length < expectedLength) raw.fill(0, raw.length, expectedLength);

return sharp(raw, {
Copy link

Copilot AI Dec 7, 2025

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.

Suggested change
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, {

Copilot uses AI. Check for mistakes.
Comment on lines +88 to +90
const pngResult = await Pix.toSharp(pixData);

return { buffer: pngResult.data, info: metadata };
Copy link

Copilot AI Dec 7, 2025

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 };

Suggested change
const pngResult = await Pix.toSharp(pixData);
return { buffer: pngResult.data, info: metadata };
return { buffer: Buffer.from(JSON.stringify(pixData, null, 2)), info: metadata };

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +103
document.getElementById("padColorValue").addEventListener("input", (event) => {
padColor = event.target.value;
document.getElementById("padColorBox").style.backgroundColor = padColor;
Copy link

Copilot AI Dec 7, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 128 to 131
if (extension == "pix") {
const pixData = Pix.openFromBuffer(buffer);
return Pix.toSharp(pixData);
}
Copy link

Copilot AI Dec 7, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +51 to +52
static async toPix(buffer, info) {
const { data, info: rawInfo } = await sharp(buffer)
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable rawInfo.

Suggested change
static async toPix(buffer, info) {
const { data, info: rawInfo } = await sharp(buffer)
static async toPix(buffer) {
const { data, info } = await sharp(buffer)

Copilot uses AI. Check for mistakes.
volta2030 and others added 4 commits December 7, 2025 09:29
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>
@volta2030 volta2030 merged commit 23b0afa into publish Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants