
Show HN: Simple image resizing/optimization service - hoahluke
https://scaley.io/
======
leni536
My acid test for image scaling software:

[http://i.imgur.com/X9vKa2s.png](http://i.imgur.com/X9vKa2s.png)

[https://i.scaley.io/png-256x128/i.imgur.com/X9vKa2s.png](https://i.scaley.io/png-256x128/i.imgur.com/X9vKa2s.png)

This means that you don't use a linear color space for blending colors.

Sorry about the language, the image is not made by me [1].

[1]
[https://web.archive.org/web/20120904060524/http://www.4p8.co...](https://web.archive.org/web/20120904060524/http://www.4p8.com/eric.brasseur/gamma.html)

edit:

I see that your backend relies on libvips to do the resizing. I have no
experience with it, but I could make libvips-tools' vipsthumbnail program work
correctly:

    
    
      $ vipsthumbnail --linear -f tn_%s.png -s 256x128 gamma-1.0-or-2.2.png
    

Note the "\--linear" option, without it produces the same wrong image.

~~~
hoahluke
I didn't think this would come up so quickly! This can actually be fixed with
an undocumented option 'gamma'[1]

I didn't include it in the website, admittedly because I didn't fully
understand it, and I wanted to keep the service as simple as possible.

Would it make sense for this to be the default?

[1] [https://i.scaley.io/png-
gamma-256x128/i.imgur.com/X9vKa2s.pn...](https://i.scaley.io/png-
gamma-256x128/i.imgur.com/X9vKa2s.png)

~~~
leni536
Nice! I think it should be the default. Some software might treats as a
compromise between correctness and cost (doing the rescaling in linear space
is usually more costly). In my view it should be correctness first.

The ImageWorsener's website as an excellent reading material on image resizing
and other transformations. ImageWorsener is a "correctness first" image
resizing software.

[http://entropymine.com/imageworsener/](http://entropymine.com/imageworsener/)

~~~
zzzcpan
"Correctness" is not very useful in image processing, it's all about
perception and performance.

~~~
XaspR8d
Well "correct" in the case of linear vs non-linear luminance is pretty much
exactly about perception (or at the very least, working to prevent perception
differences further down the pipeline), even if it is a somewhat minor effect.

"The Importance of Being Linear"[1] which just came up on HN a few days ago,
discusses some issues with non-linearity, specifically in the context of 3D
rendering.

[1] -
[http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html](http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html)

------
nodesocket
I'd like to echo the sentiment that offering 100% uptime and 3x, 5x, 10x
refunds is a dangerous decision and actually will not increase paid signups.
I've been doing operations/DevOps for over a decade (in fact I just launched a
consulting startup ([https://elasticbyte.net](https://elasticbyte.net)) that
helps companies manage their cloud infrastructure). 100% uptime is a red flag,
ops professionals never guarantee 100%.

You instead should offer standard 99.9% (44 mins a month) or 99.99% (4 min 30
sec) with standard SLA language.

~~~
wingerlang
Theoretically, I could sign up then DoS the site myself for a nice payout.

------
jimaek
CloudFlare doesn't allow this kind of use of their service. Once you start
pushing enough bandwidth they will ask you to go away. And since you offer
free unlimited CDN bandwidth, when that happens and you move to a different
CDN provider your bill could increase 50 times over a day.

~~~
jgrahamc
It's not bandwidth that is restricted by our terms of service it's...

SECTION 10: LIMITATION ON NON-HTML CACHING

 _You acknowledge that Cloudflare’s Service is offered as a platform to cache
and serve web pages and websites and is not offered for other purposes, such
as remote storage._ Accordingly, you understand and agree to use the Service
solely for the purpose of hosting and serving web pages as viewed through a
web browser or other application and the Hypertext Markup Language (HTML)
protocol or other equivalent technology. Cloudflare’s Service is also a shared
web caching service, which means a number of customers’ websites are cached
from the same server. To ensure that Cloudflare’s Service is reliable and
available for the greatest number of users, a customer’s usage cannot
adversely affect the performance of other customers’ sites. Additionally, the
purpose of Cloudflare’s Service is to proxy web content, not store data.
_Using an account primarily as an online storage space, including the storage
or caching of a disproportionate percentage of pictures, movies, audio files,
or other non-HTML content, is prohibited._ You further agree that if, at
Cloudflare’s sole discretion, you are deemed to have violated this section, or
if Cloudflare, in its sole discretion, deems it necessary due to excessive
burden or potential adverse impact on Cloudflare’s systems, potential adverse
impact on other users, server processing power, server memory, abuse controls,
or other reasons, Cloudflare may suspend or terminate your account without
notice to or liability to you.

~~~
michaelt

      You further agree that if [...] if Cloudflare, in its
      sole discretion, deems it necessary due to [...]
      other reasons, Cloudflare may suspend or terminate
      your account without notice to or liability to you.
    

I gotta say, that statement isn't very helpful in letting people know what to
avoid doing.

~~~
kbar13
these clauses are pretty common for this type of contract. it allows the
service provider to not have to worry about whether or not their contract
allows them to kick an abusive customer off their platform.

------
tonmoy
This is the tester/hacker in me talking, but have you checked for cases where
one can loop your own images hundreds of times? (e.g.
[https://i.scaley.io/jpg/i.scaley.io/png/i.imgur.com/DZjrx4E....](https://i.scaley.io/jpg/i.scaley.io/png/i.imgur.com/DZjrx4E.jpg)
but more than 2 times)

A simple url DOS attack from my puny browser may cripple your entire server.

------
hoahluke
I made this mainly because I wanted a service to use for my own projects - but
the existing solutions were either prohibitively expensive or didn't have
uptime guarantees.

The backend for the processing service is nodejs and sharp[1], processed
images are cached on CloudFlare. The processing servers are a custom instance
type in an autoscaling group on Google Cloud.

Any feedback is greatly appreciated!

[1] [https://github.com/lovell/sharp](https://github.com/lovell/sharp)

~~~
adityapatadia
Cloudflare does not permit storing just images in any of their plans. Their
terms state that serving disproportionate amount of image or video via their
service will be violation of their terms. You should check it before using it
for longh term or providing cheaper cache options to users.

~~~
hoahluke
Ah, great info - thanks for the heads up. I'll dig into that and look into
alternatives

~~~
jgrahamc
Instead of looking for an alternative, why not get in contact with Cloudflare
and talk to us about it?

~~~
hoahluke
I definitely will do that!

------
jastanton
Fun feature you should add: the ability to crop around faces. I.e say you have
a long and tall image and you need it to be square, you could pick the center,
top, or bottom to zoom in on, which do you choose? It would be nice to set a
flag and say "find the subject(s) of this photo and crop around the
subject(s)".

~~~
stachenfeld
Yeah, that is a good idea. The Google Vision API actually makes it pretty easy
to do. It is pretty amazing that this kind of thing is now possible. You can
chain together a bunch of transformations into one like [find face] + [crop
photo]. Here's one example of that implemented
[https://www.filestack.com/docs/image-
transformations/facial-...](https://www.filestack.com/docs/image-
transformations/facial-detection)

------
inka
Now I'm kicking myself because I did something very similar for one of my
clients based on AWS and shared it publicly ([https://github.com/pbudzon/aws-
image-gateway](https://github.com/pbudzon/aws-image-gateway))! Not sure how it
compares cost-wise, though. It's a combination of CloudFront, API Gateway,
Lambda and S3. I'm quite sure CloudFront doesn't have limitations on what you
can cache, like Cloudflare seems to have.

Like others who commented, I don't get the idea of image-resize-as-a-service,
so I remember I laughed at my client when they asked me for this. For some
reason I believe it's better for the world if we don't make people think it's
ok to throw around gigantic images around the cables when it's completely
unnecessary...

~~~
codegeek
Not your fault. Developers tend to sometimes underestimate the power of
releasing a command line utility as a web based/API tool that can help non
techies do simple stuff. Image resizing is a recurring candidate but there are
others like conversion tools (to pdf), checkers/monitors (ssl for example)
etc. Yes, you could do these on your server with a simple cmd line but tons of
folks are willing to pay to be able to use a browser/API to do the same.

~~~
bcjordan
It feels like a compelling property here is to have a "single point of
continuously increasing quality"—that is, one changing chunk of code that is
continuously improved and battle tested as more and more users report issues
that require workarounds.

(But of course ever-changing externally hosted web services like these have
their drawbacks.)

------
traviswingo
Awesome work! I have a suggestion/question. Why did you chose the pattern

    
    
      /:options/:image 
    

over

    
    
      /:image/:options
    
    

? Seems the latter would be more user friendly.

~~~
rayboy1995
If the image url is in front there isn't exactly a sure fire way to tell where
that url ends and where the options should begin. Of course there are work
arounds, but the way it is now it seems that it would cover every case.

~~~
traviswingo
Good point. Didn't think of that.

------
hashkb
Looks really well done! Can someone compare/contrast with Imgix?

------
0XAFFE
As so often:

Please don't show a blank page when no javascript is available.

Maybe a message that you should enable javascript or better some basic
information what your service does.

------
pag
Related: [https://transloadit.com/](https://transloadit.com/)

~~~
markplindsay
Transloadit is great. I'm using it right now with an open-source video project
([https://github.com/xiaofei-
mo/mysteriousobjectsatnoon](https://github.com/xiaofei-
mo/mysteriousobjectsatnoon)). The encoding process is just ffmpeg under the
hood, but not having to write all of the glue code to get it running with AWS
has saved me a ton of time.

~~~
kvz
Thanks! Transloadit founder here - just wanted to say if there's anything you
feel we could do better we'd love to hear that too :+1:

------
dk8996
Looks nice. Is the service smart enough to figure out the file type, for
example, image from facebook

[https://scontent.fbed1-2.fna.fbcdn.net/v/t31.0-8/11206479_82...](https://scontent.fbed1-2.fna.fbcdn.net/v/t31.0-8/11206479_820336851353851_664651990019563840_o.jpg?oh=a75345663d781526e8d8135c3a057e2c&oe=590FFF2F)

~~~
hoahluke
Thanks! And yes, it doesn't pay any attention to the original filename, image
format is detected by the data stream. Here's that image resized to 600px
wide:

[https://i.scaley.io/600-max-
https/scontent.fbed1-2.fna.fbcdn...](https://i.scaley.io/600-max-
https/scontent.fbed1-2.fna.fbcdn.net/v/t31.0-8/11206479_820336851353851_664651990019563840_o.jpg?oh=a75345663d781526e8d8135c3a057e2c&oe=590FFF2F)

------
mpweiher
I have to admit that I don't quite understand "image scaling as a service".
Scaling is almost certainly a case where shipping the image over a network is
significantly more costly than just doing the scaling locally?

~~~
chatmasta
Here the only binary program you need installed to scale the image is curl. If
you want to do it yourself, you need a whole bunch of image processing
libraries installed. Because of that, you'll probably end up separating your
image processing logic onto its own host on your internal network, anyway.
Then you're back to where you started, making an http call to an external
service. Unless latency is a critical factor, an image scaling API is
attractive because you do not need to waste development time setting up (and
scaling) your own image processing environment.

~~~
bluedino
In this case you also don't have to store the images.

------
mgottein
As someone who has never hosted an image service like this, what actions do
you have to take to stop "bad" people from using your service? For example,
uploading inappropriate / illegal / violent images.

~~~
stdio_h
I developed a website for the university I attend that anyone can upload
photographs of older exams for each course. In order to solve the image
content problem the system checks every uploaded image with a 3rd party image
recognition API[1] before saving it. Works pretty good so far!

[1][https://clarifai.com/](https://clarifai.com/)

------
niklasrde
100% Uptime Guarantee? I'd like to see a status page with some stats and maybe
simple graphs akin to
[https://status.github.com/](https://status.github.com/).

~~~
SnaKeZ
They uses Cloudflare for image caching so it's the Cloudflare uptime. Correct
me if I'm wrong.

~~~
hoahluke
Cloudflare actually doesn't have any uptime guarantees until you're on the
enterprise plan, afaik. If Cloudflare were to have an outage which caused
downtime of Scaley then the guarantee would cover that outage.

------
samblr
Neat. what stack are you using ? Something similar for those on GCP :
[https://goo.gl/dU0aKy](https://goo.gl/dU0aKy)

------
dbbk
How does this differ from Imgix?

------
fiatjaf
It can't be open like that "just use our URL" because it will bring many free-
riders and shutdown your server.

But it also can't be a closed system with private keys and all that, because
the hassle is too enormous -- the user will need a server to get the key for
each image and so on.

I have the impression that all services of this kind suffer from the above
dual-problem.

------
artursapek
<snark>For something called "scaley" your logo looks very blurry on my high-
dpi display. Use SVG!</snark>

------
mderazon
My problem is usually making the cropping "smart". I need a content-aware
cropping so that the resulting image looks good. It doesn't seem to come up
too often as a known and requested feature in most of these services, I am
wondering how come, this seems like a "must have" for me

------
acdha
Have you considered implementing IIIF? That's an emerging standard for
constructing image URLs which has a growing amount of existing client support:

[http://iiif.io/api/image/2.1/](http://iiif.io/api/image/2.1/)

------
franciscop
I wonder if any thought was put into waifu [1]. While in western countries
there is not such a big usercase, I know in Asia a good upscaling algorithm
for manga would be really popular.

[1] [http://waifu2x.udp.jp/](http://waifu2x.udp.jp/)

------
ferrantim
Very cool! How is this different from some of the alternatives like Filestack
[https://www.filestack.com/](https://www.filestack.com/). I'm not trolling,
genuinely curious.

~~~
hoahluke
The main thing I've tried to focus on is simplicity - you can just use it by
changing some URLs.

There are definitely other services out there which address the same thing,
the closest one is probably [https://rsz.io/](https://rsz.io/) which even
includes some more processing features, but it doesn't have the CDN and I
couldn't find any info about uptime.

------
time4tea
[https://github.com/springernature/immagine](https://github.com/springernature/immagine)

If you want to host it yourself...

------
aarondf
This looks like a great service, but the 3x, 5x, and 10x refunds make me very
very nervous for you. 100% uptime is practically impossible. Good luck!

~~~
tobyhinloopen
Its based on the time being down, not rounded up to a month.

Downtime of an hour equals a dollar or something

~~~
aarondf
Oh that makes me feel better. Makes sense too

------
GoToRO
Maybe you could implement Rotate from EXIF data.

------
donut
Nice features and presentation. Looks great.

But those aren't URLs. Do you document how images are retrieved, http or
https?

------
karim79
Related: [https://kraken.io](https://kraken.io)

~~~
devy
I wonder how is scaley comparing to kraken? I have used neither. Would love to
hear others' experiences.

------
jimaek
btw I am interested in all kinds of web performance optimization services
including image hosting. If anyone is interested to partner up email me at
dak@prospectone.io

~~~
pdimitar
Could you clarify a little? What do you mean you're interested? You're
founding a business and need a technical co-founder? You're a dev founding a
business and need a technical partner? You're a dev looking for work in that
area?

Might be my English (not a native speaker) but your message isn't clear.

------
kejaed
Pretty slick.

Have any signups yet?

------
johnflan
sudo apt-get install imagemagick?

