extensions icon indicating copy to clipboard operation
extensions copied to clipboard

feat: Add Quick Image Extension

Open gutenye opened this issue 11 months ago • 2 comments

Description

Quick Image is a fast, text-based tool that allows you to convert, resize, concatenate images, and create PDFs from Raycast command line. With a simple command, like jpg | ver | pdf, you can easily convert images to jpg, concat them veritcally and output a pdf file

Differences from the Image Modification: It's a text based command, that allows you to perform multiple image operations in a single line of text. It provides a powerful way and options to edit the images. This feature simplifies complex workflows by enabling you to chain commands like converting, resizing, and creating PDFs, all in one go.

Screencast

screenshot-1 screenshot-2

Checklist

gutenye avatar Dec 30 '24 08:12 gutenye

Congratulations on your new Raycast extension! :rocket:

You can expect an initial review within five business days.

Once the PR is approved and merged, the extension will be available on our Store.

raycastbot avatar Dec 30 '24 08:12 raycastbot

@pernielsentikaer

I’ve figured out a method to ship a pre-built native Node module without needing manual installation.

Now installation from the Store just works

If you want to obtain the sharp-darwin-arm64.node file by yourself, run the following commands:

brew install libvips
npm install

This will output to node_modules/@gutenye/sharp/src/build/Release/sharp-darwin-arm64.node

I’ve forked the sharp repository and implemented these changes to enable support for the prebuilt native module.

gutenye avatar Jan 10 '25 15:01 gutenye

This pull request has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊

raycastbot avatar Jan 26 '25 07:01 raycastbot

This issue has been automatically closed due to inactivity.

Feel free to comment in the thread when you're ready to continue working on it 🙂

You can also catch us in Slack if you want to discuss this.

raycastbot avatar Feb 02 '25 07:02 raycastbot

Hi @gutenye, I recently encountered the same issue. I'm not quite sure if it's caused by sharp or the Raycast API. I found that even after installing sharp, it still throws an error saying "Error: Cannot find module 'sharp'" when running npm dev or npm build. @pernielsentikaer, could you help take a look?

error when require sharp: @img/sharp-darwin-arm64/sharp.node Error: Cannot find module '@img/sharp-darwin-arm64/sharp.node'
Require stack:
- /Users/x/.config/raycast/extensions/godruoyi-tinypng-raycast/image.js
- /Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Function._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at node_modules/sharp/lib/sharp.js (/Users/x/.config/raycast/extensions/godruoyi-tinypng-raycast/image.js:6986:18)

For a quick review, Sharp will check whether the following paths exist or not, see https://github.com/lovell/sharp/blob/main/lib/sharp.js#L13-L24

I find it strange why the sharp package encounters this issue during raycast development, but these issues don't exist in other frameworks like Astro or Nuxt.

godruoyi avatar Feb 03 '25 10:02 godruoyi

I'm also quite curious about whether we can't include new code in raycast development by using require('@img/sharp-darwin-arm64/sharp.node'). I noticed that in @gutenye's implementation, we can only use this method: require('${environment.assetsPath}/sharp-${runtimePlatform}.node'). @pernielsentikaer, do you have any suggestions?

godruoyi avatar Feb 03 '25 10:02 godruoyi

hi @pernielsentikaer any syggestion on it pls👇🏾? thank you.

require('@img/sharp-darwin-arm64/sharp.node') ❌
require('${environment.assetsPath}/sharp-${runtimePlatform}.node') ✅

godruoyi avatar Feb 10 '25 05:02 godruoyi