是否有一个 .Net 库可以从图像对象列表或图像文件创建 Css 精灵?

发布于 2024-10-04 10:57:40 字数 495 浏览 0 评论 0原文

我正在使用 css sprites 优化网站的图像,但每次都很难做到这一点,因为样式会改变,图像会改变,CSS会改变,一切都会随着时间而改变。我希望将图像优化器算法集成到我们的 VisualStudio 加载项中,但我需要创建一个库来执行此操作,或者找到一个现有的库来执行此操作。

我需要这样的东西:

  • 输入:图像列表(例如列表 图像对象、图像文件列表、 无论如何...)
  • 输出: css 文件 + single-image-file

请,我需要有关如何尽可能自动化此过程的建议。

顺便说一句,它可以是一个外部程序,它不需要是一个库,但我更喜欢一个库。而且它不需要是 C# 或 VB 或任何东西......但它必须是我可以从 C# 代码调用的东西,但我还是更喜欢它是 .Net 程序集或 C# 代码 。

谢谢。

I am optimizing the images of a website using css sprites, but it is very difficult to do it all the times, because styles change, images change, css changes, everything changes with time. I wish to integrate an image optimizer algorithm into our VisualStudio add-in, but I need to make a lib to do it, or find an already existing lib that does it.

I need something like this:

  • input: list of images (e.g. list of
    Image objects, list of image files,
    whatever...)
  • output: css-file +
    single-image-file

Please, I need suggestions on how to automate this process as much as possible.

By the way, it could be an external program, it does not need to be a library, but I prefer a library. Also it does not need to be in C# or VB or anything... but it must be something that I can call from C# code, but again I prefer that it is a .Net assembly or C# code.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

意中人 2024-10-11 10:57:40

我相信 Sprite &图像优化框架就是这样做的。

I believe that the Sprite & Image Optimization Framework does just that.

流云如水 2024-10-11 10:57:40

我最近开始执行类似的任务,并认为我应该分享我的发现以供将来参考。这些项目看起来也像是可以根据需要集成或定制的可行选项:

SpriteGenerator 似乎专注于高效的图像平铺并生成所需的 css 和相关文件。

CssSpriteGenerator 和 RequestReduce 尝试通过插入 Asp.net 网站中的请求管道来评估未优化的内容,并神奇地创建和重新映射到传统 css sprite 工作会<的优化输出,从而解决这一令人头痛的过程。 /em> 已产生。这两个工具都可以将优化范围扩大到图像精灵之外,但 RequestReduce 似乎本身就可以做到这一点。

SpriteGenerator 是影响最小的解决方案,并且似乎最接近原始请求的范围。它不支持保存或加载先前配置的概念,但这是一个足够简单的自定义,并且源代码很容易获得。

然而,如果您在搜索 Google 后登陆此页面,并且正在考虑在 ASP.NET Web 服务器上自动生成精灵的选项,那么 RequestReduce 看起来是当前最好的选择,因为它完成了任务,用于高流量的 Microsoft 网站(因此可能随着时间的推移而改进)并运行各种页面优化技术。

I recently embarked on a similar task and figured I'd share my findings for future reference. These projects also look like viable options that can be integrated or customized as needed:

SpriteGenerator appears to focus on efficient image tiling and generates the needed css and related files.

CssSpriteGenerator and RequestReduce attempt to take the headache of the process by plugging into the request pipeline in your Asp.net website to evaluate your non-optimized content and magically create and remap to the optimized output that your traditional css sprite efforts would have produced. Both of these tools can expand the scope of optimization beyond just image sprites but RequestReduce appears to do it natively.

SpriteGenerator is the least far reaching of the solutions and seems to comes closest to the scope of the original request. It doesn't support the concept of saving or loading of a previous config but that's an easy enough customization and the source is readily available.

If however you land on this page after searching Google and are considering options for automatic sprite generation on your asp.net webserver, then RequestReduce looks like the current best bet as it accomplishes the task, is used on high traffic Microsoft sites(and thus likely to improve over time) and runs the gamut of page optimization techniques.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文