Change image format
Change Format transformation allows users to convert an image from one format to another. Converting an image format can be useful for several reasons, such as reducing the file size, improving image quality, or ensuring compatibility with a particular device. For example, if you have an image in JPEG format that you want to use on a website that only accepts PNG images, you would need to convert the JPEG to PNG format.
PixelBin serves the same image format as the source image after performing operations. If you want to change the output image format, you can use this parameter. Changing the format will almost always change the output image's size.
Params
Format (f
)
This parameter helps users to change the output format of an image.
Available values are jpeg
, png
, webp
, tiff
, avif
, and bmp
. jpeg
is the default.
- Original Image (format=jpeg (51.2 KB))
- Changed format (webp (35.2 KB))
- Changed format (png (189 KB))
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [],
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
},
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
),
filePath = "images/transformation/basic_car.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/basic_car.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
],
"filePath" => "images/transformation/basic_car.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:webp)/images/transformation/basic_car.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"webp"}]}],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:webp)/images/transformation/basic_car.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"webp"}]}],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:webp)/images/transformation/basic_car.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"webp"}]}],
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:webp)/images/transformation/basic_car.jpeg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
{"plugin": "t", "name": "toFormat", "values": []map[string]interface{}{ {"key": "f", "value": "webp"},}},
},
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:webp)/images/transformation/basic_car.jpeg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
TransformationObj( plugin = "t", name = "toFormat", values = hashMapOf( "f" to "webp"), )
),
filePath = "images/transformation/basic_car.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:webp)/images/transformation/basic_car.jpeg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/basic_car.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "t", name: "toFormat", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "f" }, { "value", "webp" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:webp)/images/transformation/basic_car.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "t", "name" => "toFormat", "values" => [ [ "key" => "f", "value" => "webp" ], ], ],
],
"filePath" => "images/transformation/basic_car.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:webp)/images/transformation/basic_car.jpeg
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:png)/images/transformation/basic_car.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"png"}]}],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:png)/images/transformation/basic_car.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"png"}]}],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:png)/images/transformation/basic_car.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"png"}]}],
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:png)/images/transformation/basic_car.jpeg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
{"plugin": "t", "name": "toFormat", "values": []map[string]interface{}{ {"key": "f", "value": "png"},}},
},
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:png)/images/transformation/basic_car.jpeg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
TransformationObj( plugin = "t", name = "toFormat", values = hashMapOf( "f" to "png"), )
),
filePath = "images/transformation/basic_car.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:png)/images/transformation/basic_car.jpeg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/basic_car.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "t", name: "toFormat", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "f" }, { "value", "png" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:png)/images/transformation/basic_car.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "t", "name" => "toFormat", "values" => [ [ "key" => "f", "value" => "png" ], ], ],
],
"filePath" => "images/transformation/basic_car.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:png)/images/transformation/basic_car.jpeg
?>
Quality (q
)
This parameter helps users to decide the quality of the output image.
Flat quality values are 100
, 95
, 90
, 85
, 80
, 75
, 70
, 60
, 50
, 40
, 30
, 20
& 10
.
While auto quality values are best
, good
, eco
, and low
. This is how the auto quality values work:
- Best – The least aggressive algorithm, compressing files as much as possible without any visible loss in quality.
- Good – Produces relatively small file sizes with good visual quality. Minor visual artifacts may appear, but only upon close inspection. This setting offers the best balance between file size and visual quality.
- Economy – A more aggressive approach that favors smaller file sizes, with a slight reduction in visual quality noticeable only under close examination.
- Low – The most aggressive algorithm, yielding the smallest file sizes while allowing for lower visual quality.
For now, automatic quality can only be used when converting images to AVIF
or WEBP
format.
- Original Image (jpeg, 51.2 KB)
- Changed format (avif, 31.7 KB)
- Changed format (avif, 22.7 KB)
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [],
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
},
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
),
filePath = "images/transformation/basic_car.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/basic_car.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
],
"filePath" => "images/transformation/basic_car.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/basic_car.jpeg
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:75)/images/transformation/basic_car.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"avif"},{"key":"q","value":"75"}]}],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:75)/images/transformation/basic_car.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"avif"},{"key":"q","value":"75"}]}],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:75)/images/transformation/basic_car.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"avif"},{"key":"q","value":"75"}]}],
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:75)/images/transformation/basic_car.jpeg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
{"plugin": "t", "name": "toFormat", "values": []map[string]interface{}{ {"key": "f", "value": "avif"},{"key": "q", "value": "75"},}},
},
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:75)/images/transformation/basic_car.jpeg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
TransformationObj( plugin = "t", name = "toFormat", values = hashMapOf( "f" to "avif","q" to "75"), )
),
filePath = "images/transformation/basic_car.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:75)/images/transformation/basic_car.jpeg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/basic_car.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "t", name: "toFormat", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "f" }, { "value", "avif" } }, new Dictionary<string, string>() { { "key", "q" }, { "value", "75" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:75)/images/transformation/basic_car.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "t", "name" => "toFormat", "values" => [ [ "key" => "f", "value" => "avif" ], [ "key" => "q", "value" => "75" ], ], ],
],
"filePath" => "images/transformation/basic_car.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:75)/images/transformation/basic_car.jpeg
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:good)/images/transformation/basic_car.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"avif"},{"key":"q","value":"good"}]}],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:good)/images/transformation/basic_car.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"avif"},{"key":"q","value":"good"}]}],
filePath: "images/transformation/basic_car.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:good)/images/transformation/basic_car.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"toFormat","plugin":"t","values":[{"key":"f","value":"avif"},{"key":"q","value":"good"}]}],
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:good)/images/transformation/basic_car.jpeg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
{"plugin": "t", "name": "toFormat", "values": []map[string]interface{}{ {"key": "f", "value": "avif"},{"key": "q", "value": "good"},}},
},
"filePath": "images/transformation/basic_car.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:good)/images/transformation/basic_car.jpeg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
TransformationObj( plugin = "t", name = "toFormat", values = hashMapOf( "f" to "avif","q" to "good"), )
),
filePath = "images/transformation/basic_car.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:good)/images/transformation/basic_car.jpeg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/basic_car.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "t", name: "toFormat", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "f" }, { "value", "avif" } }, new Dictionary<string, string>() { { "key", "q" }, { "value", "good" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:good)/images/transformation/basic_car.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "t", "name" => "toFormat", "values" => [ [ "key" => "f", "value" => "avif" ], [ "key" => "q", "value" => "good" ], ], ],
],
"filePath" => "images/transformation/basic_car.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/t.toFormat(f:avif,q:good)/images/transformation/basic_car.jpeg
?>
When changing the format of a multi-page image, such as a tiff file, only the first page is transformed.