How i can resize Adobe Illustrator Artwork (AI) File to increased Dimension without losing quality in PHP...












0















When user upload AI file then if Dimension of an uploaded file is less than or equal to (180 x 180) then I want to resize this file to increased dimension (277 x 277) and then convert it to JPG. I tried code mentioned below. I tried all ways which are commented in the code.



    $image_rs = new Imagick();
$image_rs->readimage(realpath(SOURCE_UPLOAD_PATH.$source_file_name));
if($fileType == "ai"){
$image_rs->setIteratorIndex(0);
}
$dimensions = $image_rs->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
if($width <= 180 && $height <= 180){
//$image_rs->magnifyImage();
$image_rs->setImageFormat($source_file_ext);
$image_rs->scaleImage(277,0);
// $image_rs->adaptiveResizeImage(277,277);
// $image_rs->resizeImage(277,277,Imagick::FILTER_CATROM, 1, true);
$image_rs->writeImage(realpath(RESIZED_UPLOAD_PATH)."/". $source_file_name);

$image = new Imagick();
$image->readimage(realpath(RESIZED_UPLOAD_PATH.$source_file_name));
if($fileType == "ai"){
$image->setIteratorIndex(0);
}
$dimensions = $image->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
$image->thumbnailImage($width, $height);
$image->writeImage(realpath(CONVERTED_UPLOAD_PATH)."/". $source_file_name_without_ext.".jpg");
}


Issue: By using this code image is resized successfully but resized AI file also becomes blurry. because of Imagick library when resizing the image it converts AI file to jpg. AI file is vector file so there is no chance to become blurry even if we increase dimension. So how I can do this by imagemagick?










share|improve this question

























  • Try setting the destination size before reading the vector graphic with $image_rs->setSize(277, 277).

    – emcconville
    Nov 16 '18 at 15:22











  • changing destination size before reading file is not working for vector graphic,its only working for images.if any another library for same is available in PHP, please inform me.

    – Harry baldaniya
    Nov 19 '18 at 5:15
















0















When user upload AI file then if Dimension of an uploaded file is less than or equal to (180 x 180) then I want to resize this file to increased dimension (277 x 277) and then convert it to JPG. I tried code mentioned below. I tried all ways which are commented in the code.



    $image_rs = new Imagick();
$image_rs->readimage(realpath(SOURCE_UPLOAD_PATH.$source_file_name));
if($fileType == "ai"){
$image_rs->setIteratorIndex(0);
}
$dimensions = $image_rs->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
if($width <= 180 && $height <= 180){
//$image_rs->magnifyImage();
$image_rs->setImageFormat($source_file_ext);
$image_rs->scaleImage(277,0);
// $image_rs->adaptiveResizeImage(277,277);
// $image_rs->resizeImage(277,277,Imagick::FILTER_CATROM, 1, true);
$image_rs->writeImage(realpath(RESIZED_UPLOAD_PATH)."/". $source_file_name);

$image = new Imagick();
$image->readimage(realpath(RESIZED_UPLOAD_PATH.$source_file_name));
if($fileType == "ai"){
$image->setIteratorIndex(0);
}
$dimensions = $image->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
$image->thumbnailImage($width, $height);
$image->writeImage(realpath(CONVERTED_UPLOAD_PATH)."/". $source_file_name_without_ext.".jpg");
}


Issue: By using this code image is resized successfully but resized AI file also becomes blurry. because of Imagick library when resizing the image it converts AI file to jpg. AI file is vector file so there is no chance to become blurry even if we increase dimension. So how I can do this by imagemagick?










share|improve this question

























  • Try setting the destination size before reading the vector graphic with $image_rs->setSize(277, 277).

    – emcconville
    Nov 16 '18 at 15:22











  • changing destination size before reading file is not working for vector graphic,its only working for images.if any another library for same is available in PHP, please inform me.

    – Harry baldaniya
    Nov 19 '18 at 5:15














0












0








0








When user upload AI file then if Dimension of an uploaded file is less than or equal to (180 x 180) then I want to resize this file to increased dimension (277 x 277) and then convert it to JPG. I tried code mentioned below. I tried all ways which are commented in the code.



    $image_rs = new Imagick();
$image_rs->readimage(realpath(SOURCE_UPLOAD_PATH.$source_file_name));
if($fileType == "ai"){
$image_rs->setIteratorIndex(0);
}
$dimensions = $image_rs->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
if($width <= 180 && $height <= 180){
//$image_rs->magnifyImage();
$image_rs->setImageFormat($source_file_ext);
$image_rs->scaleImage(277,0);
// $image_rs->adaptiveResizeImage(277,277);
// $image_rs->resizeImage(277,277,Imagick::FILTER_CATROM, 1, true);
$image_rs->writeImage(realpath(RESIZED_UPLOAD_PATH)."/". $source_file_name);

$image = new Imagick();
$image->readimage(realpath(RESIZED_UPLOAD_PATH.$source_file_name));
if($fileType == "ai"){
$image->setIteratorIndex(0);
}
$dimensions = $image->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
$image->thumbnailImage($width, $height);
$image->writeImage(realpath(CONVERTED_UPLOAD_PATH)."/". $source_file_name_without_ext.".jpg");
}


Issue: By using this code image is resized successfully but resized AI file also becomes blurry. because of Imagick library when resizing the image it converts AI file to jpg. AI file is vector file so there is no chance to become blurry even if we increase dimension. So how I can do this by imagemagick?










share|improve this question
















When user upload AI file then if Dimension of an uploaded file is less than or equal to (180 x 180) then I want to resize this file to increased dimension (277 x 277) and then convert it to JPG. I tried code mentioned below. I tried all ways which are commented in the code.



    $image_rs = new Imagick();
$image_rs->readimage(realpath(SOURCE_UPLOAD_PATH.$source_file_name));
if($fileType == "ai"){
$image_rs->setIteratorIndex(0);
}
$dimensions = $image_rs->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
if($width <= 180 && $height <= 180){
//$image_rs->magnifyImage();
$image_rs->setImageFormat($source_file_ext);
$image_rs->scaleImage(277,0);
// $image_rs->adaptiveResizeImage(277,277);
// $image_rs->resizeImage(277,277,Imagick::FILTER_CATROM, 1, true);
$image_rs->writeImage(realpath(RESIZED_UPLOAD_PATH)."/". $source_file_name);

$image = new Imagick();
$image->readimage(realpath(RESIZED_UPLOAD_PATH.$source_file_name));
if($fileType == "ai"){
$image->setIteratorIndex(0);
}
$dimensions = $image->getImageGeometry();
$width = $dimensions['width'];
$height = $dimensions['height'];
$image->thumbnailImage($width, $height);
$image->writeImage(realpath(CONVERTED_UPLOAD_PATH)."/". $source_file_name_without_ext.".jpg");
}


Issue: By using this code image is resized successfully but resized AI file also becomes blurry. because of Imagick library when resizing the image it converts AI file to jpg. AI file is vector file so there is no chance to become blurry even if we increase dimension. So how I can do this by imagemagick?







php imagemagick






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 6:00









Sayed Mohd Ali

1,5242520




1,5242520










asked Nov 16 '18 at 5:44









Harry baldaniyaHarry baldaniya

115111




115111













  • Try setting the destination size before reading the vector graphic with $image_rs->setSize(277, 277).

    – emcconville
    Nov 16 '18 at 15:22











  • changing destination size before reading file is not working for vector graphic,its only working for images.if any another library for same is available in PHP, please inform me.

    – Harry baldaniya
    Nov 19 '18 at 5:15



















  • Try setting the destination size before reading the vector graphic with $image_rs->setSize(277, 277).

    – emcconville
    Nov 16 '18 at 15:22











  • changing destination size before reading file is not working for vector graphic,its only working for images.if any another library for same is available in PHP, please inform me.

    – Harry baldaniya
    Nov 19 '18 at 5:15

















Try setting the destination size before reading the vector graphic with $image_rs->setSize(277, 277).

– emcconville
Nov 16 '18 at 15:22





Try setting the destination size before reading the vector graphic with $image_rs->setSize(277, 277).

– emcconville
Nov 16 '18 at 15:22













changing destination size before reading file is not working for vector graphic,its only working for images.if any another library for same is available in PHP, please inform me.

– Harry baldaniya
Nov 19 '18 at 5:15





changing destination size before reading file is not working for vector graphic,its only working for images.if any another library for same is available in PHP, please inform me.

– Harry baldaniya
Nov 19 '18 at 5:15












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332094%2fhow-i-can-resize-adobe-illustrator-artwork-ai-file-to-increased-dimension-with%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332094%2fhow-i-can-resize-adobe-illustrator-artwork-ai-file-to-increased-dimension-with%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma