10 ms·
Show HN: Bulk convert images online without sending to server
There are lots of solutions already, but most solutions have too many ads or they process on server(privacy concern).
Webutils convert all images on client using webassembly.
- KaoruAoiShiho 5y agoIs there an open sourced version of this so I can process the images the user uploads first before sending it to s3 thus saving space?
- akmittal 5y agoI have published to npm https://www.npmjs.com/package/optimg-wasm https://www.npmjs.com/package/optimg-wasm Sorry there is no documentation for now. Will be doing it first thing tomorrow (IST)
- KaoruAoiShiho 5y agoThank you, awesome.
- KaoruAoiShiho 5y agoDocumentation? xD
- akmittal 5y agoIts done now https://www.npmjs.com/package/optimg-wasm https://www.npmjs.com/package/optimg-wasm Still very rough though, Will do a better job when i have more time.
- KaoruAoiShiho 5y agoThanks!
- h2odragon 5y agoor there's http://www.imagemagick.org/ http://www.imagemagick.org/
- akmittal 5y agoYes, Imagemagick is great and I love it. But most people are not comfortable using CLI or someone may just not want to install it for one off conversion. Also webapp works on smartphones, tablets or anything with browser, while Imagemagick does not. Imagemagick is ofcourse lot more feature rich and fast. If anyone is already comfortable using Imagemagick, webapp is not for them.
- s_gourichon 5y agoThese points are only weakly in favor of such a web app. Don't like CLI? Use gimp or similar. Don't want to install anything? On some OS it might make sense. On that OS consider Paint. It probably does not support webp, but if you're serious about webp you have tools. Smartphone/tablet? Is there even a need to do conversion on those? Privacy? Use an operating system that has some reputation, like Debian stable, not a web app. IMHO this web app is a nice exercice for its author.
- poisonborz 5y agoThis is so much of a HN comment that I wonder if it's satire or written by a bot.
- dang 5y ago"Please don't sneer, including at the rest of the community." It's reliably a marker of bad comments and worse threads. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- karanbhangui 5y agoHN feedback has become cancer. OP, this site is great, and even as a highly technical user, I'd use this site in a heart beat. Thank you!
- deleted 5y ago[deleted]
- personjerry 5y agoHow can it be both online AND not need a server? In this case, it sounds like it's not online -- you can simply save the script.
- akmittal 5y agoImages are not send to server, all processing is on client side. Server is required to download the webpage/wasm, but not to process files. In future planning to make the app available offline using service worker. So first time internet would be required, next time onwards without internet also it will work.
- tantalor 5y agoThe actual conversion is offline, so "convert online" is kind of weird/confusing.
- rubyist5eva 5y ago"convert online" = "using a webpage in a browser"
- hunter2_ 5y agoYou can certainly open local html files that run JS using a web browser while your network stack is offline though, and doing so can't be described as being online. I guess you could argue whether doing this actually constitutes opening "web pages" but I think most people would say it does.
- rubyist5eva 5y agoSince the vast majority of people would probably not do that, I don't see a reason to be so pedantic.
- akmittal 5y agoI think turning it into PWA with offline support much better.
- jeroenhd 5y agoThis looks like a nice alternative to https://squoosh.app/ https://squoosh.app/. I particularly like the "resize image to a particular size" (https://www.webutils.app/compress-image-to/50kb https://www.webutils.app/compress-image-to/50kb) feature, that's very useful. Sadly, because of the nature of the web, one can never be sure that the image actually stays within the browser. There's no way to prevent it from secretly sending everything you convert with this to some shady website because it runs in the browser. I trust the people behind this just fine, but sadly the promise of offline-level privacy and running code inside the browser just don't go well together.
- tyingq 5y agoI tried making a chrome dev tools network throttling profile set to "0 kbps", and it seems to work...you get "no internet" if you try and reload the page, xhr in the console fails, etc. So cumbersome, but it does work.
- akmittal 5y agoI guess one may disable wifi+data if on mobile. Disconnect wifi of on Desktop, but agree with OP there is no good way to check if processing is actually happening locally.
- gruez 5y ago>if you try and reload the page, xhr in the console fails, etc. what about: * DNS leaks (eg. trying to connect to payloadhere454098357987.attacker.example, leaks payloadhere454098357987 to the attacker) * websocket * webRTC * prefetching * service workers (background sync) * beacons * CSP reports
- tyingq 5y agoSure, there is probably more needed. Some of your list is covered though. For example, I tried websockets, and those are blocked by the throttle.
- sokoloff 5y ago
- ir193 5y agowell done! i really wish more tasks can be done in browser. did you compile some c++ library into wasm or js is enough to do the job?
- akmittal 5y agoI actually use wasm build by https://squoosh.app/ https://squoosh.app/ team.
- dylan604 5y ago>Bulk convert images online without sending to server If the data never leaves the local, how is it online? "Bulk convert images in the browser without sending to server" seems more appropriate
- akmittal 5y agoI probably messed up the title, I mean you need to be online to use webapp, but app won't sent any images to remote server for processing.
- hunter2_ 5y agoWould it be possible to eliminate the need to be online, so then you could make the much more enticing claim (for privacy-conscious users) that it works offline? Maybe a PWA, or just by clicking "File > Save."
- dylan604 5y agoThis isn't any different from any other image processing app that you download and use, except you have to download it every time you need to use it again. So the advantage is that you don't have to make multiple versions of native apps, and you didn't make it an electron app. Other than that, it's YA image tool. I hope you learned whatever you set out to learn with this.
- tomcatfish 5y agoI disagree with this and it's overly negative. This is pretty useful for places where you are unable to download applications.
- arriu 5y agoThanks for building this! Would you be able to add something like dcraw.js for various RAW file support?
- yawnxyz 5y agoThis is so cool! I'm completely new to WASM but excited to learn — how did you use the Squoosh repo to turn it into WASM, and how did you embed that into your app? Is that just a static file you can "import" and use in the client? And can anything be "turned into" WASM (e.g. a python library), or is that kind of a new paradigm of writing code from scratch?
- ficklepickle 5y agoIts probably not practical to use python because I imagine you'd need to include the whole python interpreter or somesuch. WASM is a compilation target for AOT compiled code.
- akmittal 5y agoSquoosh already had wasm files built, all i had to just import and create a common API. For now wasm can be compiled from C,C++, Rust and Go, so mostly compiled languages. https://emscripten.org/ https://emscripten.org/ can help compile C,C++, Rust and Go has native support to compile. There is also a Typescript like language which compile to wasm(assembly script) Python or most dynamic languages are too difficult to compile to wasm.
- zamber 5y agoYou could consider publishing it on GitHub and pinging squoosh guys: https://github.com/GoogleChromeLabs/squoosh/issues/1084 https://github.com/GoogleChromeLabs/squoosh/issues/1084
- MBlume 5y agohttps://github.com/pyodide/pyodide https://github.com/pyodide/pyodide > Any pure Python package with a wheel available on PyPi is supported. Many packages with C extensions have also been ported for use with Pyodide. These include many general-purpose packages such as regex, PyYAML, lxml and scientific Python packages including NumPy, pandas, SciPy, Matplotlib, and scikit-learn.
- skilled 5y agoNice! Thank you.
- zerop 5y agoRecommend a good such tool for all kinds of image editing /Cropping/etc in browser?
- poniko 5y agoPixlr E has a batch tool with 20+ things you can batch .. also in the browser, just like all of the Pixlr tools. (https://pixlr.com/e/ https://pixlr.com/e/)
- rikschennink 5y agoNot op but I created https://edit.photo https://edit.photo just for that :) It’s 100% private, editing happens in the browser.
- akmittal 5y agoThanks for creating this, Saw your tweet other day. It looks really great.
- elcamino44 5y agophotopea.com is basically photoshop 6 in the browser. I use it all the time.
- xml 5y agoI also implemented a batched client-side web tool to resize photos to a certain file size (in a few hundred lines of JS). It only supports JPEG, but it resizes photos almost instantly https://randomforest.net/resizePhoto.html https://randomforest.net/resizePhoto.html Here are a few ideas to make yours faster: 1. Use the browser's canvas element to compress JPEG or PNG images instead of WASM. The libraries which come with browsers can use processor-specific instructions, while WASM only targets the smallest common denominator of the most common architectures, so it will be slower. 2. Which resizing method are you using to find a fitting image size? For me, it worked well enough to downscale by some factor a few times until it fits, but if you want to get super close, you could use binary search.
- mnutt 5y agoMy experience has been that using canvas to resize images produces inconsistent results from one browser to another, and in most cases is higher file size and lower quality than other tools. Enabling imageSmoothingEnabled helps, but is only supported in chromium-based browsers right now: https://caniuse.com/mdn-api_paintrenderingcontext2d_imagesmoothingenabled https://caniuse.com/mdn-api_paintrenderingcontext2d_imagesmo...
- dilliwal 5y agoBookmarked! thanks for this amazing tool.
- kretaceous 5y agoOh heavens, this is really neat! Thank you! I love Squoosh but I often have a multiple photos to compress to WEBP. On a similar note, does anyone know similar lightweight web/desktop apps for basic photo editing, specifically, resize, conversion, crop, color overlay, etc. I use Photopea[0] on Linux but I still feel I could go lighter. [0]: https://photopea.com https://photopea.com
- jakub_g 5y agoCheck https://edit.photo https://edit.photo - it's similar to popular Android native mobile apps.
- bserge 5y ago
- kingcharles 5y agoWebassembly is going to be fantastic for building a lot of similar apps like this that avoid the server. It also keeps costs of the developer to a minimum because huge data files are not being transferred to/fro.
- josefrichter 5y agoI’ve actually done this 10 years ago with HTML canvas - resizing images on client side before upload, to save bandwidth and speed everything up: https://github.com/josefrichter/resize https://github.com/josefrichter/resize
- zamber 5y agoThis uses WebAssembly so it can preserve PNG transparency for example, which the canvas method loses.
- josefrichter 5y agoyes of course, wasm is far superior. we are 10 years farther, after all. it just reminded me that the problem of resizing before upload exists for at least a decade, even solutions exist for at least a decade, yet it’s still rarely being solved. maybe it’s not the biggest problem, so devs focus on other stuff.
- ramraj07 5y agoI want to make an app that allows folks to upload an excel file and I want to extract just the top 10k rows of the first two columns to plot them. I’m afraid of allowing an upload option for a free service, can I parse an xls file using wasm and avoid uploading anything?
- akmittal 5y agoTechnically that's possible, you can compile any C, Rust or Go Excel parcer and use that.
- 5y ago
- cblconfederate 5y agoThis is the real decentralized web. Current web sucks because your data touches servers you re supposed to "trust". Trust nothing
- leppr 5y agoYou still have to trust that the server is not going to target you and send you a trojan version. Content hashes (like in IPFS or git) are needed to minimize the trust on servers.
- flykespice 5y ago
- Krasnol 5y agoNow get DICOM in there too ;)
- dvhh 5y agodifferent from vips for webassembly ? https://wasm-vips.kleisauke.nl/playground/ https://wasm-vips.kleisauke.nl/playground/
- majora2007 5y agoWoah, I didn't realize vips had a webassembly build. I use VIPS for my project and it is a rockstar.
- foxbee 5y agoDo you have any plans to commercialize this service?
- akmittal 5y agoNo, want to keep it ad free always
- thehappypm 5y agoThis is cool. I’m working on a PDF editor that’s totally client-side, do things like merge files and the like.